Nested Comments in C/C++

Viewed 13526

This is an interview question:-

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.

The solution to this problem is given below :-

Sol:- you can have an integer variable nest:

int nest = /*/*/0*/**/1;

if it supports nested comments then the answer is 1 else answer is 0.

How is this working ? I don't understand the variable declaration.

6 Answers
Related