Issue with sizeof(array) strings and enums
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
I don’t know why y_hooks altered it, but I don’t think this code does what you think. Your enum can also be written as:

Код:
enum {
    Player_Name = 0,
    Player_Password = Player_Name + MAX_PLAYER_NAME,
    Player_Salt = Player_Password + PASSWORD_LENGTH,
    e_PlayerInfo = Player_Salt + SALT_LENGTH,
};
The things in an enum are not arrays, they just have syntax that looks like arrays. However, hopefully now you can see why sizeof (data[Player_Name]) is always just 1.
I thought I understood enumerators, and this is how I've seen them used (as a 'nametag' to a specific value in an array).
I guess I'll have to re-read some documentation on the subject and try to figure it out.

Thanks for the help!
Reply


Messages In This Thread
Issue with sizeof(array) strings and enums - by Aire - 06.12.2018, 14:37
Re: Issue with sizeof(array) strings and enums - by coool - 06.12.2018, 14:56
Re: Issue with sizeof(array) strings and enums - by Aire - 06.12.2018, 15:13
Re: Issue with sizeof(array) strings and enums - by Aire - 06.12.2018, 16:12
Re: Issue with sizeof(array) strings and enums - by Aire - 06.12.2018, 19:15

Forum Jump:


Users browsing this thread: 2 Guest(s)