I had a char "chr" and a char array "filename" declared on the same line "char chr, filename[256];", and i was getting a weird segmentation fault when i tried to free an array of char pointers for which i had allocated memory with malloc. It seemed it was only the first pointer i tried to free that was causing the problem, and i eventually found out its address gets changed by 0x10 when i assign "chr" a value via scanf. So i moved the declaration of "chr" to a new line and now the pointer address doesn't change.

So is this not allowed? It usually seems to work.