|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 loner 于 2013-6-16 11:00 编辑
#include<stdio.h>
int i; //位置1
int main()
{
struct student
{
char name[20];
char phone[11];
};
struct student san[3];
printf("please input name:");
gets(san[0].name);
printf("\nplease input phone");
gets(san[0].phone);
printf("\nplease input name:");
gets(san[1].name);
printf("\nplease input phone");
gets(san[1].phone);
printf("\nplease input name:");
gets(san[2].name);
printf("\nplease input phone");
gets(san[2].phone);
int i; //位置2
for(i=0;i<=2;i++)
printf("\name:%s\tphone%s\n",san.name,san.phone);
getch();
}
当我把i定义到位置1时,VC++6.0不报错,程序也能正确执行,但当我把i定义到位置2时,编译就不能通过,但我觉着没错啊 ,求大鸟解释、、
|
|