Aritra Mukherjee Aritra Mukherjee - 6 months ago 41
C Question

'c' file handling program

can anyone give any idea about how to write a program to indent a 'c' source code in a file?


is it possible

  • yes, but not easy. There are lots of IDEs that try, and some do better than others.

comments are not taken into consideration

they have to be. Let's look at the code

void foo()
/** {this does something **/
{ baz(); }

you need to register that the { is in a comment, else you'll end up with everything with an extra tab, and a non-matching { at the end.