Calling and Called function & Actual and formal parameters

Let us take an example:

main() //  Here main()---> Calling Function because it is calling calsum

{

int a,b,c,sum; //------> Actual Parameters

printf("Enter values of a, b & c");

scanf("%d %d %d",&a,&b,&c);

sum=calsum(a,b,c);

printf("Sum = %d",sum);

}

calsum(x,y,z) //x,y,z-----> Formal parameters, calsum ---> Called Function

{                          // because it is called by some other function

int d;

d=x+y+z;

return(d);

}

 

Jump statements

-> Goto [Avoided in normal programming.]

-> Continue

-> Break

-> Return

 

Syntax are as follows:

-Goto:

goto label;
statement1;
label: statement2;

Only statement2 will be executed and statement 1 won’t be executed as the programs makes a jump to label.

 

-Continue:

Example:

for(i=0;i<=n;i++)

{

statement1;

continue;

statement2;

}

 

In this loop statement1 gets executed and statement2 will not be executed!

Continue statement after statement1 takes the control back to the decision making

i.e., foor loop here, and hence it skips the statement2 in each execution till n.

 

-Break:

Eg:

while(condition)

{

printf(“hi”);

break;

printf(“hello”)

}

 

This program prints hi and won’t print hello because before it moves to the

statement which prints hello break is encountered which beings the control out of the while loop and hence only hi is printed.

 

-Return:

return(value)

Eg:

main()

{

return(0)

}

It returns 0 to the main function.