Coding Villa Forum
FAQs
Advertisements

Compiler error: Type Mismatch in re-declaration of function display in C.

Iram Online 6/30/2012 12:14:39 PM

Hello Friends!

I am trying to compile following code in C but compiler is displaying following error message.

"Type mismatch in the redeclaration of function display"

I am pasting code here. So please friends guide me as I need your guidance to solve that problem.


main()
      {       

           char string[]="Hello World";

            display(string);

       }

void display(char *string)

     {

          printf("%s",string);

     }

Thanks

Share with Friends

Advertisements

Answer

Mehmood Online 7/1/2012 8:42:34 PM

I see two incorrect things in your cpp source.

First, you forgot to declare the function and second you should use int main().

In c#, we don't write the declaration but in c we require to mention.

i molded the source , now see, it works in TC (Turbo C 3.0)

#include
#include

void Display(char *string);

int main()
{
char string[]="Hello World";

Display(string);

return 0;

}
void Display(char *string)
{

printf("%s",string);

}


Share with Friends

Post reply

 

Enter This Code
Captcha
 

Subscribe

Email me when people reply


Subscribe to the