Code:
main( )
{
float a = 15.5 ;
char ch = 'C' ;
printf ( "\n%f %c", a, ch ) ;
printit ( a, ch ) ;
getch();
}
printit ( float sa, char sch )
{
printf ( "\n%f %c", sa, sch ) ;
}
|
Newbie Member
|
|
| 6Dec2008,11:32 | #1 |
|
Code:
main( )
{
float a = 15.5 ;
char ch = 'C' ;
printf ( "\n%f %c", a, ch ) ;
printit ( a, ch ) ;
getch();
}
printit ( float sa, char sch )
{
printf ( "\n%f %c", sa, sch ) ;
}
Last edited by shabbir; 6Dec2008 at 12:50.. Reason: Code block |
|
Mentor
|
![]() |
| 6Dec2008,14:20 | #2 |
|
What compiler are you using?
Does it work correctly if you redefine printit to void instead of default-int and place it above main (or prototype it)? Tried it in Visual Studio 2005 and it wouldn't compile because of the above; I set the return of printit to void and moved it above main and it worked fine. So I'd guess this is either a compiler bug or a consequence of some of the default behaviour you're relying on here (mainly that when the compiler finds printit in use it assumes its prototype is "int printit()" ). |