Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C code to detect if the compiler allows comments to nest

Tags:

c

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 to go about this ?

like image 877
Arihant Nahata Avatar asked Dec 13 '22 09:12

Arihant Nahata


1 Answers

int noNesting = 0 /* /* */ + 1 // */
;
like image 177
Alex Avatar answered Dec 14 '22 22:12

Alex