Functions
#include <stdio.h>
int sum(int i, int j);
main()
{
int a, b, res;
a = 1; b = 2;
res = sum(a, b);
printf("%d + %d = %d\n",
a, b, res);
}
int sum(int i, int j)
{
int k;
k = i + j;
return k;
}
Prototype
declaration
Function definition
Function parameters
Function return value
Call/invoke a function
Arguments
This is program
pg154.c
.
Next slide
Back to first slide
View graphic version