Error : Conflicting type for

Raven9's Avatar, Join Date: Aug 2011
Newbie Member
Code:
#include <stdio.h>
#include <stdlib.h>

main( )
{
float a, b ;
printf ( "\nEnter any number " ) ;
scanf ( "%f", &a ) ;
b = square ( a ) ;
printf ( "\nSquare of %f is %f", a, b ) ;
}
square ( float x )
{
float y ;
y = x * x ;
return ( y ) ;
}

This Program gives me error of 'conflicting type for' in code blocks build.
And Whenever i run this program then it does'nt show the output in float but in integer type. Please Give the reason for this.... And also guide me how to get floating type output from this program.

Last edited by shabbir; 7Aug2011 at 09:58.. Reason: Code blocks
michael j g's Avatar
Go4Expert Member
Excuse me i do not know but did you miss "int"
I tryed copying your code and i wouldent know but it may take a problem away?
Not sure:
Your Code:

Code:
#include <stdio.h>
#include <stdlib.h>

int main( )
{
float a, b ;
printf ( "\nEnter any number " ) ;
scanf ( "%f", &a ) ;
b = square ( a ) ;
printf ( "\nSquare of %f is %f", a, b ) ;
}
square ( float x )
{
float y ;
y = x * x ;
return ( y ) ;
}
i have tryed some of the skills playing around with it as well.
I do not know but read the Messages and right click them and go to location.
you will find the location of the problem!

They are mostly tips.!
PS: the code above that i copyed has an added int at location "int main()"

Sorry and Thanks!
Tryed to help

Last edited by shabbir; 7Aug2011 at 09:58.. Reason: Code blocks
Raven9's Avatar, Join Date: Aug 2011
Newbie Member
Thanks...!!

Well After restarting my PC it Does'nt give me that type of error also..!!