Usually, when faced with the decision of 'Type' or 'Variable of type', the compile will always assume 'Variable of type', which is why accessing User
as object works.
However, at the same time, declaring a new object with the type User
fails to work, because for the compiler, that's a variable, not a type.
In short: Rename your variable User
to anything but the type name (i.e. UserObject
or something), and your code should work just fine in that regard.
For the clarification, this is my suggested fix:
void RemoveUserFromGameRoom(User *myUser) {
if (myUser->GameRoom != NULL) {
GameRoom *GameRoom = myUser->GameRoom;
//More code to come
}
//Some more code
}