Learn how to Make Money Online | Free Tech Magazines
Go4Expert
Go4Expert RSS Feed

Go Back   Programming and SEO Forum >  Go4Expert > Queries and Discussion > Programming > C-C++

Reply Copy HTML to Clipboard  Copy BBCode to Clipboard  Add to del.icio.us  Add to Google  Digg it  Add to Yahoo !  Add to Windows Live  Add to Facebook  Add to StumbleUpon 
 
Bookmarks Thread Tools Search this Thread Display Modes
Old 10-29-2006, 02:07 AM   #1
hamidr
Newbie Member
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
hamidr is on a distinguished road
Angry

" 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?

Last edited by shabbir; 10-29-2006 at 10:09 AM. Reason: Code formating.
hamidr is offline   Reply With Quote
Old 10-29-2006, 10:12 AM   #2
shabbir
Go4Expert Founder
 
shabbir's Avatar
 
Join Date: Jul 2004
Location: On Earth
Posts: 10,943
Thanks: 35
Thanked 167 Times in 139 Posts
Rep Power: 10
shabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud of
Send a message via Yahoo to shabbir

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.
shabbir is offline   Reply With Quote
Old 10-29-2006, 01:46 PM   #3
Aztec
Contributor
 
Aztec's Avatar
 
Join Date: May 2006
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4
Aztec is on a distinguished road

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?
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.
__________________
Technological progress is like an axe in the hands of a pathological criminal.
Aztec is offline   Reply With Quote
Reply Copy HTML to Clipboard  Copy BBCode to Clipboard  Add to del.icio.us  Add to Google  Digg it  Add to Yahoo !  Add to Windows Live  Add to Facebook  Add to StumbleUpon 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Bookmarks

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads / Articles
Thread Thread Starter Forum Replies Last Post
PCC-S-02201 Error while compiling Proc program narayananml C-C++ 4 11-06-2007 12:49 AM
"Cannot Open Include File" MS Visual C++ compiler error analeah C-C++ 3 09-02-2006 02:01 PM
Data Types in MySQL pradeep MySQL / PostGRESQL 0 07-07-2006 04:28 PM
Web Server Error Messages pradeep Web Development 1 04-27-2005 06:37 AM
Closing Error Reporting (Win XP) vishal sharma Windows 1 07-28-2004 12:52 PM

 

All times are GMT +5.5. The time now is 04:54 AM.