Code:
Line 30: non-lvalue in assignment
I just need an explanation, why did the error occurred, how do I fix it, and what should I do to prevent that in future. Thanks
Rich (BB code):
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct { char name[30];
char lastname[30];
int points;
}PLAYER;
PLAYER input();
PLAYER input()
{
PLAYER A;
printf("Name?\n");
scanf("%s",A.name);
printf("Last Name?\n");
scanf("%s",A.lastname);
printf("Points?\n");
scanf("%d",&A.points);
return(A);
}
int main()
{
int i,n,*niz;
niz = (int*)malloc(n*sizeof(int));
do{
printf("Number of Players?\n");
scanf("%d",&n);
}while(n<1);
for(i=0;i<n;i++)
(niz+i)=input();
system("pause");
}
I just need an explanation, why did the error occurred, how do I fix it, and what should I do to prevent that in future. Thanks
Last edited by a moderator: