#include "stdio.h"
int main(void)
{
int order, nextp, N=3;
char cont;
nextp = 0;
printf("\nShould we continue (y or n): ");
scanf("%c", &cont);
if (cont != 'y') return;
for(; nextp < N; nextp++)
{
printf("Enter order number: ");
scanf("%d", &order);
printf("you have entered %d\n", order);
printf("okay now continue with cont\n");
printf("enter cont y or n: ");
scanf("%c", &cont);
if (cont != 'y')
{
printf("\nnot equal to y\n");
break;
}
printf("after intepreting t[0]");
}
return 0;
}
उत्पादन इसscanf इनपुट के लिए दूसरी बार
Should we continue (y or n): y
Enter order number: 45
you have entered 45
okay now continue with cont
enter cont y or n:
not equal to y
दूसरे इनपुट छोड़ दी गई थी की तरह लग रहा नहीं कहेंगे। क्यूं कर?
इस पर एसओ पर एक अरब बार चर्चा की गई है। मौजूदा प्रश्नों पर थोड़ा सा शोध करने का प्रयास करें – fayyazkl