Arguments and Parameters:
Arguments and parameters are variables used in a Function. Variables used in a Function calling( Function reference) are called Arguments. These are written within the parentheses followed by the name of the Function.
Variables used in the Function definition are called Parameters. Parameters must be written within the parenthesis followed by the name of the Function, in the Function Definition.So let us understand Parameters and Arguments with the help of Program.
Statement of C Program: This program accepts a Number and prints its Square.
#include<conio.h>
void square(int i); /* Function Declaration */
void main()
{
int a;
clrscr();
printf(" Enter the value of a\n");
scanf("%d" , &a);
square(a); /* Function calling */
getch();
}
void square( int i ) /* Function Definition*/
{
int b;
b= i*i;
printf(" square = %d\n" , b);
}
Output:
Enter the value of a
2
square = 4
That's All
0 Response to "WAP of C Languge Function that Calculates the Square of a accepted number"
Post a Comment