Computer Programming C Laboratory: Functions C Programs

C Program to call function with parameter

calling function - Modular Programming - Functions C Programs - C Programming

Function call with parameter.

/* C Program to call function with parameter */

#include <stdio.h>

#include <conio.h>

void main()

{

int k; /* Local definitions */

/* Statements */

clrscr();

k = add(10, 20); /* Function call */

printf ("The value of k is %d\n", k);

getch();

} /* main */

int add (int x, int y)

{

int z;

z = x + y;

return (z);

} /* add */

OUTPUT

The value of k is 30

EXPLANATION: The compiler automatically transfers the control to the function add(), then the function add() is executed after that, the add() function returns some value to the calling function.


Computer Programming C Laboratory: Functions C Programs : Tag: C Programming : - C Program to call function with parameter


Computer Programming C Laboratory: Functions C Programs



Under Subject



Related Subjects