06.12.2018, 14:37
(
Последний раз редактировалось Aire; 06.12.2018 в 14:42.
Причина: Accidentally pasted wrong compile errors.
)
I'm trying to get the size of a string contained in an array (NOT the length of text in the string).
This code:
...returns these compile errors:
I'm not an amazing coder, and I'm just beginning to learn, but this seems odd to me.
As far as I can tell, this should work just fine, but sizeof() refuses to work like this.
I swear I've used it before like this, and I would check, but that project was deleted.
Am I missing something silly, or have I done something horribly wrong?
Any help is appreciated, thanks!
This code:
Код:
#define SALT_LENGTH 65
#define PASSWORD_LENGTH 65
enum e_PlayerInfo {
Player_Name[MAX_PLAYER_NAME],
Player_Password[PASSWORD_LENGTH],
Player_Salt[SALT_LENGTH]
};
new Player[MAX_PLAYERS][e_PlayerInfo];
OnGameModeInit() {
printf("%i", sizeof(Player[0][Player_Name]));
}
Код:
includes\../player/account.pwn(47) : error 001: expected token: "]", but found "-integer value-" includes\../player/account.pwn(47) : warning 215: expression has no effect includes\../player/account.pwn(47) : error 001: expected token: ";", but found "]" includes\../player/account.pwn(47) : error 029: invalid expression, assumed zero includes\../player/account.pwn(47) : fatal error 107: too many error messages on one line
As far as I can tell, this should work just fine, but sizeof() refuses to work like this.
I swear I've used it before like this, and I would check, but that project was deleted.
Am I missing something silly, or have I done something horribly wrong?
Any help is appreciated, thanks!


