I'm new in C and would appreciate if anyone can help me out on this one:
My program haults with a "segmentation fault". I was using malloc() etc so I suppose there was sth wrong with that. But what really puzzles me is that the problem would disappear if I comment out certain lines of code that weren't even executed at all. And when I add some dummy codes back in, the problem reappears, sometimes at a different point. The errors occur either at "free()" or when it was accessing some dynamically allocated memory.
Can someone tell me why such errors would appear/disappear with addition/deletion of dummy codes that weren't even executed at all? And maybe point to me what may be going wrong?
thanks a lot.