0
How to write a c program to remove all comments in a given program
6 ответов
+ 2
Do you want to remove all comments fron a source file in C?
I so, one possible way will be to:
1. Open source file
2. Open destination file
3. Read line (if not eof)
4. Process line:
a. If you find // after ; place \0 instead of the first /
b. If there is /* skip the rest of the line, and set a flag to mark that you must skip following lines until you found the closing */
5. Write "clean" line to destination file
6. Go to 3
7. Close files
This is just an idea from the top of my head. Rough edges must be worked out possibly...
+ 1
This program works decently... Read one char per loop instead of one line as I suggested above.
https://code.sololearn.com/cCMYe0I766ss/?ref=app
0
OK thank u diego Code
0
How to give a file as an input to a c program.
0
write a c program to creat folder called my folder?
0
Use
system(command);
command is (a string) an os command...
Ej md folder