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.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>