I have the below function which I want to return a pointer to the array of type struct. However, I'm unsure of the syntax; what do I need to type as the return type of the function and in the prototype? I have tried the following (as per what I'd read in similar threads online):
but that doesn't work.
Also with regards to returning the pointer which of the following would be correct:
Thanks in advance.
int currentPlayer = 0;
int cnt_scoreC, cnt_scoreT, cnt_startScore, numDarts, cnt_legs,
cnt_sets, clk_currentNum, clk_startNum, s_numDarts, s_won,
struct player players[MAXPLAYERS]; //players struct array
struct player *playersPtr; //pointer capable of pointing to struct player
playersPtr = &players[MAXPLAYERS]; //put address of players array into players pointer
PS: I have put comments next to the pointer stuff on what I thought was happening, can anyone confirm if this is right?