字符串数组中查找为空的数组
程序代码:
#include<stdio.h> #include<string.h> struct Student { char num[6]; char name[10]; int math; int english; int general; }; struct Student stu[100]={{"05001","Jam",78,68,146},{"05002","Bill",80,98,178},{"05003","Bob",82,83,165},{"05004","Sam",69,82,151},{"05005","Steven",94,83,177}}; void main() { int i,j; for(i=0;i<100;i++) if(stu[i].num[0]==NULL) j=i; printf("%d",j); }我本意是求出j=5,结果却是j=99。
求指点