Function with no arguments & with return value in C
Notes:
Function with no arguments and with return value in C Programming:
A function without arguments and with return value:
A function without parameters and with return value:
- How to create a function; which does not accept any parameters but returns a value
Ex:
#include <stdio.h>
float PI();
float E();
int main()
{
printf("%.3f\n",PI()); // 3.142
printf("%.3f\n",E()); // 2.718
return 0;
}
float PI()
{
return 3.142;
}
float E()
{
return 2.718;
}