I have a doubt on function returning a value. Consider the following program snippet.
int add(int a,int b) {
int c=a+b;
return;
}
int main() {
int a=10,b=20;
printf("%d %d %d",a,b,add(a,b));
return(0);
}
The above program gives the output as
10 20 30
But the function is not returning any value. According to the K&R C, Section 4.1,
".......there need be no expression after return; in that case, no value is returned to the caller."
I will be grateful if anyone explains the logic behind this cryptic.
Thanks in advance.