Whats wrong with this C program?
- by Prab
It should give me the number of inputs entered by the user. But it gives 100. I compiled with gcc.
#include <stdio.h>
int arr[100];
int count=0;
int max=100;
int main(){
int i, input;
printf("Enter integer values one by one, q to quit.\n");
for(i=0;i<max;i++){
scanf("%d",&input);
arr[i]=input;
if(input=='q')break;
count++;
}
printf("You entered %d values.\n",count);
return 0;
}