This resulted in my program crashing, but if I changed the name "Test1" in the structure to ANYTHING else, it would work. It would alse work if theChoice was any other string as well.
To fix it, I ended up changing int NoP to something else and the program didn't crash! Then I went back and changed NoP to what it was before, and the crash didn't happen.
Nah, what I wrote up there isn't what I had in the program, just a generalization to explain what happened. But I was wrong, the problem didn't get fixed.
I fixed it though, but the thing that boggles my mind is why the program didn't crash if I ran a different string through the program..
Because the string was placed in the exact same location.
That's common with undefined behavior, especially if it involves invalid pointer accesses - sometimes it crashes, sometimes it doesn't, sometime it breaks other parts of the program by overwriting memory it shouldn't...
To see where the error(s) are, we need to see the actual code, though.