You should
never use
scanf("%s", &y);
if
y
is declared as
char
.
You should always check
scanf
function result (it should be
1
in your case).
You have to consider that console input is buffered, that is,
scanf
doesn't return until you press return.
Please consider posting more meaningful info,
"It doesn't work" is really poor.