Question checking for nesting of comments

ritesh2190

Member
Joined
Jun 7, 2011
Messages
15
Programming Experience
1-3
i am writing a program which takes a c program as input and it has to check whether there is a nesting of comments in that c program and gives an output based on that,how do i go about that
 
By nested comments I assume that you mean something like:
VB.NET:
/* blah /* blah */ blah */
In that case you can call String.IndexOf in a loop. If you find the opening tags and closing tags in the wrong order then you have nested comments.
 
Back
Top