Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 45

  Shared By: Adah Miller    Date: Jan 24    Category: C Programming    Views: 82

Answer:

main()
{
show();
}
void show()
{
printf("I'm the greatest");
}


Answer:
Compier error: Type mismatch in redeclaration of show.


Explanation:
When the compiler sees the function show it doesn't know anything about it. So the default return type (ie, int) is assumed. But when compiler sees the actual definition of show mismatch occurs since it is declared as void. Hence the error.
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().

Share: 
 

Didn't find what you were looking for? Find more on C programming practical question 45 Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: