【发布时间】:2014-02-28 23:11:09
【问题描述】:
这是一个使用 C 语言制作的 FCFC 模拟器程序。我遇到了这个特定的错误“运行时检查失败 #2 - 变量 'd' 周围的堆栈已损坏。”在我完成为每个进程输入所有输入之后。 我做错了什么?
void getdata()
{
char d;
printf("Enter the number of process: ");
scanf("%d",&n);
printf("\nDo you need to enter the arrival time of process [Y/N]: ");
scanf("%s",&d);
printf("\n");
for(int i=0; i<n; i++)
{
printf("*******************************************\n");
printf("Enter the %d process burst time: ",i+1);
scanf("%d",&b[i]);
if(d=='y' || d=='Y')
{
printf("Enter the %d process arrival time: ",i+1);
scanf("%d",&a[i]);
}
else
{
a[i]=0;
}
}
}
【问题讨论】:
-
重新标记为 c,不是 c++。
标签: c