//code for mvt. in this ch did not scan by compiler. ch is used as a condition for loop . Its initial value is 'y' , and if it goes to 'n' , loop breaks. In this code i am asking user if he/she want to continue then press y else n . but don't know why gcc do not wait for scan it. It is a simple code but i can not get the mistake.
int main(){
char ch;
temp=tm;
ch='y';
for(i=0;ch=='y';i++){
printf("enter memory size for process %d",i+1);
scanf("%d",&m);
if(m<temp)
{printf("memory allocated\n"); ms[n]=m; n++;
temp-=ms[i];
}
else
{printf("memory not allocated\n"); }
https://stackoverflow.com/users/10404087/rishabh-sharma
printf("do you want to continue");
scanf("%c",&ch);
}
printf("total memory : %d\n",tm);
printf("process \t occupied \n");
for(i=0;i<n;i++)
printf("%7d \t %8d \n",i+1,ms[i]);
printf("total externel fregment : %d \n",temp);
return 0;
}