Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   " conflicting types " error!! (http://www.go4expert.com/forums/conflicting-types-error-t1750/)

hamidr 29Oct2006 02:07

" conflicting types " error!!
 
when i compile a simple program in Dev C++ i get error:" conflicting types for 'myf' "
Code:

#include <stdio.h>
#include <stdlib.h>
int main()
{
  myf(3.0);
  return 0;
}

double myf(double x)
{
  return x;
}

what does that mean? :mad:

shabbir 29Oct2006 10:12

Re: " conflicting types " error!!
 
You have posted it as an Article under the Article / Source code section. I have moved it to the Queries and Discussion forum.

Use the code blocks for putting codes in the post

I am not sure why there should be an error but I dont have the compiler so I could not solve it but try putting the function body above main and see if it solves the problem.

Aztec 29Oct2006 13:46

Re: " conflicting types " error!!
 
Quote:

Originally Posted by hamidr
when i compile a simple program in Dev C++ i get error:" conflicting types for 'myf' "
Code:

#include <stdio.h>
#include <stdlib.h>
int main()
{
  myf(3.0);
  return 0;
}

double myf(double x)
{
  return x;
}

what does that mean? :mad:

Since you didn't provide the prototype of the function, so your compiler is assuming the type of function to be int but later finds a double as a type.

To rectify it, provide the prototype of the function and stay happy.


All times are GMT +5.5. The time now is 05:02.