Well it's an interesting approach to say the least.
But you need to make some numbers the same. I suggest some #define constants.
Code:
struct arry{
char str[15];
}a[15];
void main() {
FILE *fp;
struct stu stus[100];
int i = 0;
if((fp = fopen("d:\\student.txt","rt+")) == NULL) {
printf("Cannot open the file!");
exit(1);
} else {
// should be while(i < 15 && fgets(a[i].str,20,fp) !=NULL)
while(fgets(a[i].str,20,fp) !=NULL)
{
stus[i].sno = strtok(a[i].str,",");
stus[i].sname = strtok( NULL, "," );
stus[i].sex = strtok( NULL, "," );
printf("%s %s %s\n", stus[i].sno,stus[i].sname,stus[i].sex);
i++;
}
for(int j = 0; j < i; j++) {
printf(" %s %s %s \n", stus[j].sno,stus[j].sname,stus[j].sex);
}
}
}
The red numbers should be the same, and so should the blue numbers.
And main should return int, not void (see the FAQ)