Function call

Function call: In function call there are following three parts:

a.      Function name

b.      Actual arguments

c.       Semicolon

Function name is must be same as we declared in our program and we have to give actual arguments in function call. The actual arguments contains the values itself and the formal parameters are use to catch that values. And at the end a semicolon is used to terminate it.

Syntax:      function-name(actual-arguments);

e.g             disp(10,11.17);

Program:

PROGRAM TO FIND SQUARE OF A NUMBER USING FUNCTIONS

#include<stdio.h>

#include<conio.h>

int sqre(int);

void main()

{

int n,s;

clrscr();

printf(“Enter any number: “);

scanf(“%d”,&n);

s=sqre(n);

printf(“Square of given number is:%d”,s);

getch();

}

int sqre(int a)

{

return(a*a);

}

Posted in C

Leave a Reply

Your email address will not be published. Required fields are marked *