I am just learning pthreads, and the only examples I have pass an int pointer to the shared data which is an integer(obviously).
I have a structure:
Code:
struct player { char form; char first_team; char playing; };
I have a 2D array of cells each containing a player structure:
Code:
struct player myplayer[r][c];
I am trying to get each of these cells in the 2D array to run its own pthread, in which the thread's function changes some of the variables (form, first_team, playing) of the structure.
At the moment I keep getting 'myplayer[0][0] is undefined in the function...' so I am not passing it correctly as I am unsure how to do this.
I am having trouble with the syntax for passing this structure/ a pointer to this structure to the pthread. Any help would be greatly appreciated. Thanks.