return_type function_name (
Return Type can be :
Function Name has to be a combination of :
underscore [ _ ]
Note : Name of a function never begin with digits.
Arguments can be :
Note : You can have no argument or one or more arguments . If you don’t have any argument that means you are not passing any value.
Your Important Code
Illustration with Example
int add (int a,int b)
a + b;
return (a+b) ;
void main ()
int sum = 0,num1,num2;
printf(“Enter Your Number :”);
printf(“nnEnter Your 2nd Number :”);
sum = add(num1,num2);
printf(“nn The Sum is %d”,sum);
Enter Your 1st Number : 5
Enter Your 2nd Number : 6
The Sum is 11
In the above program we have two functions main() and add().
First we have add() function in which we are performing the addition.
In the add() function we have two arguments (int a , int b). argument a contains the value of num1 and argument b contains the value of num2. Finally, we are returning the added value of a and b which is of type int .
In the main() function we are taking the two inputs from the users and then storing it in two variables num1 and num2 using printf() and scanf() functions . Then making a call to function add() and storing the value returned by the add() function in the variable sum .
And finally we printing the sum on the screen with a proper message .
If you have any query in any part then do leave us a comment . Thanks !!!