Standard library functions
(inbuilt functions) : printf(), sqrt()
User-defined functions
#include <stdio.h>
#include <math.h>
int functionName(a,b)
{
... .. ...
... .. ...
}
int main()
{
... .. ...
... .. ...
somme = functionName(a,b);
... .. ...
... .. ...
}
User-defined function
)#include <stdio.h>
int sumIntegers(int a, int b); // function prototype (declaration)
int main()
{
int int1,int2,result;
printf("Enters two numbers: ");
scanf("%d %d",&int1,&int2);
result= sumIntegers(int1, int2); // function call
printf("result= %d",result);
return 0;
}
int sumIntegers(int a, int b) // function definition
{
int c;
c= a + b;
return c; // return statement
}
// Passing arrays to functions
float calculateSum(int X[]) {
... ..
}
// Passing two-dimensional arrays
void displayNumbers(int X[2][2])
{
... ..
}