Function with arguments & with return value in C
Notes:
Function with arguments and return value in C Programming:
- Function with argument and with return value in C :
- A function with parameters and with return value in C:
- How to create a function; which accepts parameters as well as returns a value
Ex:
#include <stdio.h>
int square(int num);
int sum(int num1,int num2);
int main()
{
int rValue = square(2);
printf("%d\n",rValue); // 4
printf("\n");
rValue = sum(2,3);
printf("%d\n",rValue); // 5
printf("\n");
printf("%d\n",sum(4,5)); // 9
return 0;
}
int square(int num)
{
return num * num;
}
int sum(int num1,int num2)
{
return num1 + num2;
}