I am an amateur programmer and I am programming as a hobby only.
I am using an older system (OS X 10.5) with XCode 3.1.2 and writing in C++.
I am writing a poker program that uses a global struct to contain the variables used by the program for the current hand.
The struct is on the stack and should exist for the entire exceution cycle.
The struct is used by all functions as a work area and is passed by reference.
This struct contains a clear function that zeros all elements and is invoked at the beginning of each hand.
After exactly 119 hands(every time), the program crashes at the same line returning "EXC_BAD_ACCESS".
The line in question loads the "winninghand" string variable with a static string and executes fine before this.
I have checked the struct's size with "sizeof" and it never changes.
My question is why am I getting the error after 119 perfect runs?