well, the first thing you did was read the value:
char keys = 'l';
while( keys != 'x' ) {
...so I suggest you give it an initial value that is anything but 'x' to make sure you get into your loop. Leaving it uninitialized is a bad idea.
Alternatively, put your exit condition in the loop. And check your return values!
for(;;) {
char key;
int numberOfFieldsScanned = scanf("%c", &key );
if( numberOfFieldsScanned != 1 || key == 'x' ) break;
switch( key ) {
/* blah blah blah */
}
}
char keys = 'l';
while( keys != 'x' ) {
...so I suggest you give it an initial value that is anything but 'x' to make sure you get into your loop. Leaving it uninitialized is a bad idea.
Alternatively, put your exit condition in the loop. And check your return values!
for(;;) {
char key;
int numberOfFieldsScanned = scanf("%c", &key );
if( numberOfFieldsScanned != 1 || key == 'x' ) break;
switch( key ) {
/* blah blah blah */
}
}