Would the following program compile?


struct syntax

{

int i ;

float g ;

char c ;

}

main( )

{

printf ( “I won’t give you any error” ) ;

}

Ans: The above program successfully compiles and on execution prints the message given in printf( ). In the above programĀ  the structure syntax is declared but not terminated with the statement terminator, the semicolon. The compiler does not give any error message for it. This is because the compiler assumes that main( ) function has a return type of struct syntax and hence it successfully compiles and executes the program.

It's very calm over here, why not leave a comment?

Leave a Reply




Categories

UserOnline

Improve the web with Nofollow Reciprocity.

Powered by Yahoo! Answers