Calling function : Sample Code

Saturday, December 26, 2024

Calling Function Sample Code

#include<stdio.h>
 #include<conio.h>
 void main()
 {
 int a,b,c;
 printf("\nEnter the two numbers : ");
 scanf("%d %d",&a,&b);
 c = sum(a,b);
 printf("\nAddition of two number is : ");
 getch();
 }
 int sum ( int num1,int num2)
 {
 int num3;
 num3 = num1 + num2 ;
 return(num3);
 }

Analysis of Code :

Calling Function Syntax :
Syntax :
function_name ( Parameter1 ,Parameter2 ,....Parameter n); 
  1. In the above example sum(a,b); is function call .
  2. a,b are parameters passed to function 'sum'
  3. Function call should be made by ending Semicolon

0 comments:

Total Visits

  © Blogger templates Newspaper by Ourblogtemplates.com 2008

Back to TOP