I just entered the lands of Undefined bahavior ^^
here is the story:
I was writing a short code (only about 100 lines)
and as it was just some kind of 'quick and dirty' thing, I did not looked to closely what i did. anyway I had the first version running, and got no errors.
then I wanted to add something. but the code unexpectedly crashed. (some pointer mess)
So when I searched for the bug i only looked at the differences to the first version, as the first version was running smoothly.
I found out that the first version runs smoothely until I added another Variable declaration.
that was kind of an 'wtf?' moment.
I looked over the code again, and did not find anything. Instead of posting the code here and make another "help my I'm stupid"-thread, I slept a night over it.
here is the error:
C-code a little fukced to make it easier to read. and left out unimportant stuffs
} //so basicaly reads a string from stdin into a linked list
//some random codestuffs here
as one can easily
-> undefined behavior
just wanted to share my stupidity with someone who understands it XD