When y for char type the scanf () the back to add a getchar (), if not add getchar (), at the back of the data values will be equal to \ n;
# include & lt; Stdio. H>
# define M 3
Int main ()
{
Char a, [M].
char data;
Int I, y.
int j=0;
Printf (" please enter: ");
For (I=0; i
The scanf (" % c ", & amp; A [I]);
getchar();
}
Printf (" result is: ");
For (I=0; i
Printf (" % c ", a [I]);
}
printf("\n");
Printf (" ha ha ha ");
The scanf (" % d ", & amp; Y);
//getchar ();
//getchar ();
Printf (" please input to query letters: ");
The scanf (" % c ", & amp; The data);
While (data!=a [j])
{
j++;
}
Printf (" is: % d ", j);
getchar();
getchar();
return 0;
}