This is an interview Question that i was asked recently:
Write a C program which when compiled and run, prints out a message indicating whether the compiler that it is compiled with, allows /* */ comments to nest
How t开发者_如何学JAVAo go about this ?
int noNesting = 0 /* /* */ + 1 // */
;
int main(void)
{
int temp=0 /* /* */ + 1 // */
;
//if nesting allowed temp value woud be 0 otherwise it would be 1
if(temp)
{
printf("Nesting not allowed");
}
else
{
printf("Nesting allowed");
}
return 0;
}
精彩评论