default function prototype

When the compiler sees a new function (ex. show) about which it doesn’t know anything. It by default assumes the function to be returning int. But when compiler sees the actual definition of function (show), if mismatch occurs (might be because of other return type) error is generated.
main(){
show();
}
void show(){
printf(“I’m the greatest”);
}
The solutions are as follows:
1. declare void show() in main() .
2. define show() before main().
3. declare extern void show() before the use of show().

Leave a Reply

Your email address will not be published. Required fields are marked *