1 / 15

4-4 Inter-Function Communication

4-4 Inter-Function Communication.

Download Presentation

4-4 Inter-Function Communication

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 4-4 Inter-Function Communication Although the calling and called functions are two separate entities, they need to communicate to exchange data. The data flow between the calling and called functions can be divided into three strategies: a downward flow, an upward flow, and a bi-directional flow. Topics discussed in this section: Basic Concept C Implementation Computer Science: A Structured Programming Approach Using C

  2. Note The C language uses only call by value and return to achieve different types of communications between a calling and a called function. Call by value: value of parameter is passed, so changes made to parameter in function are not reflected in the calling function. Computer Science: A Structured Programming Approach Using C

  3. FIGURE 4-17 Downward Communication in C Computer Science: A Structured Programming Approach Using C

  4. FIGURE 4-18 Downward Communication Computer Science: A Structured Programming Approach Using C

  5. FIGURE 4-19 Upward Communication in C Computer Science: A Structured Programming Approach Using C

  6. FIGURE 4-20 Upward Communication Computer Science: A Structured Programming Approach Using C

  7. Note To send data from the called function to the calling function: 1. We need to use the & symbol in front of the data variable when we call the function. 2. We need to use the * symbol after the data type when we declare the address variable 3. We need to use the * in front of the variable when we store data indirectly Computer Science: A Structured Programming Approach Using C

  8. FIGURE 4-21 Bi-directional Communication in C Computer Science: A Structured Programming Approach Using C

  9. 1 FIGURE 4-22 Bi-directional Communication Computer Science: A Structured Programming Approach Using C

  10. FIGURE 4-23 Exchange Function Computer Science: A Structured Programming Approach Using C

  11. FIGURE 4-24 Calculate Quotient and Remainder Computer Science: A Structured Programming Approach Using C

  12. PROGRAM 4-8 Quotient and Remainder Computer Science: A Structured Programming Approach Using C

  13. PROGRAM 4-8 Quotient and Remainder Computer Science: A Structured Programming Approach Using C

  14. PROGRAM 4-8 Quotient and Remainder Computer Science: A Structured Programming Approach Using C

  15. PROGRAM 4-8 Quotient and Remainder Computer Science: A Structured Programming Approach Using C

More Related