Mismatch function in c/c++

main()
{
char string[]=”hello world”;
display(string);
}
void display(char *string)
{
printf(“%s”,string);
}
Tutorial answer:Compiler Error; Type mismatch in redeclaration of function display.
Debugger solution:The compiler doesn’t know anything about the function display. it assumes the arguments and return types to be integers,(default type0.when it sees the actual function display, the arguments and type contradicts with what it has assumed previously .hence a compile time error occurs.

Post a Comment

0 Comments