C Programming Notes
C Programming Notes
// function prototype
int main()
{
int n1,n2,sum;
printf("Enters two numbers: ");
scanf("%d %d",&n1,&n2);
sum = addNumbers(n1, n2);
// function call
printf("sum = %d",sum);
return 0;
}
int addNumbers(int a,int b)
{
int result;
result = a+b;
// function definition
return result;
// return statement
Syntax = return(expression);
FUNCTION TYPES
1)
2)
3)
4)
The recursion continues until some condition is met to prevent it. To prevent infinite
recursion, if...else statement can be used where one branch makes the recursive
call and other doesnt