Based on the symptoms above what posssibly am I doing wrong in my code?
Nobody can tell with that less information (OS and version, C::B version, MinGW version etc.).
But if your app crashes (and not Code::Blocks) it's definitely your code or your setup what is wrong.
And if that's the case, your post is violating our forum rules.
Only question related to C::B itself are allowed here.
Genral programming questions have to be asked on othe sites/mailing lists.