C ways of calling function

Ways of Calling a Function

Way 1 : Simply Call function without Parameter

void main()
{
int num
message();
}

Way 2 : Simply Call function be Passing Parameter

void main()
{
int x
display_value ( x );
}

Way 3 : Function Called from printf Statement

printf ("Square of %d is %d : ",a,square(a));

Way 4 : Assign Return value to the Variable .

area = cal_area(rad);

Way 5 : Called from if-else

if ( square (a) > 100)
          {
          //Statement 1
          //Statement 2
          }

Way 6 : Nested Calling

maximum = max ( a,max ( b , c ) );

Way 7 : Function Call in While Loop

while(!empty())
   {
   -------
   -------
   -------
   }
  • Function Called at Entry Level.
  • Negation of Return Value is Calculated.
  • If Negation Of Returned Value is Non-Zero then While Loop Gets Executed.