Function with no argument but return value In C Program | Coding classpoint

Function with no argument but return value


When a function has arguments, it receive any data from the calling function but it returns no values.

Syntax: 

int fun(void); 

 main() 

 {

 int r; 

 r=fun(); 

 }

 int fun() 

 { 

 reurn(exp);

 } 

Example: 

int sum(); 

 main() 

 { 

 int b=sum(); 

 printf(“entered %d\n, b”); 

 } 

 int sum() 

 { 

 int a,b,s;

s=a+b; 

 return s; 

 }

 Here called function is independent and are initialized. The values aren’t passed by the calling function. Here the calling function and called function are communicated partly with each other.

Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.