I am stuck at a program where I have to convert “for-loop”/“do-while loop”
to “while loop”
without changing the meaning of the program. There may be loops inside loops and so on. The input would be a C
language program and output would be a valid C language program.
The solution I got so far is to read a C program from a file and if I detect a for statement, I take the initializer out and replace "for"
with "while"
.
But I am not getting as to how to do it.