|
我在程序中有这种现象说内存不能写!
studentnum我在别的地方已经声明了.下面的子函数为什么会造成错误呢?
#include <stdio.h>
#include "glandclmenuprint.h"
struct student studentgrandcl[4];
void glanclprint()
{
int i,j,k,num1,num2;
scanf("%d,%d");
if (num1 < 4 && num1 > 0)
{
printf("你输入的年级必须在1~3级之间!");
printf("重新输入!!!");
glandclmenuprint();
glanclprint();
}
if (num2 < 10 && num2 > 0)
{
printf("你输入的班级必须在1~9班之间!");
printf("重新输入!!!");
glandclmenuprint();
glanclprint();
}
for (i=0;i<4;i++)
{
if (studentnum.grade_num == num1 && studentnum.class_num == num2)
{
for (j=0;j<4;j++)
studentgrandcl[j] = studentnum
}
}
for (k=0;j<k;k++)
printf("%-7d%-7s%-7s%-7d%-7d%-7d%-7d%-7d%-7d%-7d\n",studentgrandcl[k].num,
studentgrandcl[k].name,studentgrandcl[k].grade_num,studentgrandcl[k].class_num,
studentgrandcl[k].age,studentgrandcl[k].chinese,studentgrandcl[k].math,
studentgrandcl[k].englist,studentgrandcl[k].tel);
}
:-( :-( :-( :-( :-( |
|