void bar() means that bar returns nothing. I'm curious to know, If void returns nothing, then why doesn't the compiler(GCC) gives any warnings or errors, when compiling following program?
#include <stdio.h>
void foo (void)
{
printf("In foo() function\n");
}
void bar (void)
{
printf("In bar() function\n");
return foo(); // Note this return statement.
}
int main (void)
{
bar();
return 0;
}
I have compiled using gcc -Wall myprog.c, and it's working fine.
returnto interrupt the function.