Hi guys.
Check out the following code:
The problem is that ALWAYS appears the "Memory error!" message.Code:typedef struct{ int jugador; int cartes[19]; }Jugada; void iniciarPartida(int numbaralles, Pila *baralla,Oponent *oponents,Jugador *jugador,int noponents){ Jugada *jugades; int tot; tot = noponents + 1; jugades = (Jugada*)malloc(sizeof(Jugada)*tot); if(jugades == NULL){ printf("Memory error!\n"); } else{ //Here I run my code } }
What am I doing wrong?
Thanks!