求大神解答,left operand must be l-value
程序代码:
typedef struct list { int number; char name[20]; char writer[20]; float price; char date[20]; int state; }LIB; char *fn1="d:\\num.txt",*fn2="d:\\data.txt"; FILE *fp1,*fp2; void shanchu() { LIB *p; int num,i,j; num=fornum(); fp2=fopen(fn2,"r"); p=(LIB*)malloc(num*sizeof(LIB)); fread(p,sizeof(LIB),num,fp2); fclose(fp2); for(i=0;i<num;i++) printf("\t%d\t%s\t%s\t%.1f\t%s\t%c\n",(p+i)->number,(p+i)->name,(p+i)->writer,(p+i)->price,(p+i)->date,(p+i)->state); printf("请输入您想删除内容的对应序号\n"); scanf("%d",&i);i--; fflush(stdin); for(j=i;j<num-1;j++) { (p+j)=(p+j+1);//这里提示有错误:left operand must be l-value } free(p); num-=1; fp1=fopen(fn1,"w"); fprintf(fp1,"%d",num); fclose(fp1); }
错误的那一行我是想把(p+i)的地址传(p+i+1).想知道怎么改才可以,谢谢了