You #define i to be 10, then declare an int variable i. But the preprocessor first goes through and replaces all occurances of 'i' with 10 in your code, so it looks something like:
Code:
int main()
{
int nos[10]={0};
int 10=0,j=1,chck,count=0;
for (10 =0; 10<10; 10 ++){
printf("Enter no %d: ",j);
scanf("%d",&nos[10]);
j++;
}
printf("Enter no to search for: ");
scanf("%d",&chck);
for (10=0; 10<10; 10 ++){
if(nos[10]==chck){
count=count+1;
}
}
if(count>0){
printf("Number %d is found %d times.",chck,count);
}
printf("Number not found");
getch();
return 0;
}
All that stuff in red is where i got replaced by 10. It's common convention to make anything you #define be all caps so you know what is a preprocessor symbol and what isn't. Also, picking a more sensible name than 'i' would be good, like MAX_NUMS. So try #define MAX_NUMS 10. Then your code should be like:
Code:
#define MAX_NUMS 10
...
int nos[MAX_NUMS] = {0};
...
for (i = 0; i < MAX_NUMS; i++)