Character Array in C
Can any one tell me what is wrong in this program ? //******************************************************************** #include<stdio.h> int main() { char a[5]={' ',' ',' ',' ',' '},search; for(int i=0;i<=4;i++) { printf("\n Character %d:",i+1); scanf("%c",&a[i]); } printf("Enter character to be found"); scanf("%c",&search); for(int i=0;i<=4;i++) { if(a[i]==search) { printf("\n\n\t%c is found at %d",search,i+1); break; } if(i==4) { printf("\n\n\t%c is not found",search); } } return 0; }