Inter Function communication
The calling and called functions are two different entities and they need to communicate to exchange data. The data flow between the calling and the called functions can be divided in to three strategies: a downward flow, an upward flow and a bi-directional flow.
Note: The C language uses only pass by value and returns to achieve three types of communications between a calling and a called function.
Downward communication:
In downward communication, the calling function sends data to the called function. The called function may change the value passed, but the original values in the calling function remains in the same. An example of this type of communication is passing data to a print function.
int main(void)
{int a;.....downFun (a,15);...} // mainvoid downFun (int x, int y){...return;} //downfun//Function Declarationvoid downfun (int x, int y)int main(void){// Local Definitionsint a=5;// StatementsdownFun (a,15);printf(“%d\n”, a);return 0;} //mainvoid downFun(int x, int y){//Statementsx = x+y;return;} //downFun
Social Plugin