I have a struc called player, and I need to make an array of MAX players, so I based on the following page C - initialize array of structs, like so:
DEFINE MAX 200
typedef struct
{
int ID;
} Player;
Player* PlayerList = malloc(MAX * sizeof(Player));
Problem is I keep getting the following error
error: expected expression before ‘=’ token
error: initializer element is not constant
Base code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX = 200;
typedef struct
{
int ID;
} Player;
Player *PlayerList;
int start()
{
PlayerList = malloc(MAX * sizeof(Player));
return 1;
}
int main(int argc, char const *argv[])
{
/* code */
return 0;
}