|
|
I just wasted a long time trying to find a bug in my C program. My code was something like:
int a=1;
//some comment \
a++;
printf("%d\n",a);
The output was always 1 and I couldn't figure out why. It turns out that the a++; is part of the comment due to the '\' escape character, so it never gets executed. The really annoying thing is that my editor (Kate) didn't show it as a comment, so it was really hard to find. Interestingly in Java this problem doesn't happen. I hope this post saves people from a similar problem. |