please help, quick question.
Code:
How do I get the scanf statement to read a character from user input?.A for ascending and D for descending.....It doesn't error but its not working properly.......Is there something wrong with my if statement maybe?
Thanks for any help.
char x[1];
int c;
printf("\nEnter a to sort in ascending order.\n");
printf("Enter d to sort in descending order.\n");
for(c = 1; c <= 1; c++){
scanf("%s",&x[c]);}
if (x[c] == 'a'){
bubble(a, SIZE, ascending);
printf("\nNumbers in ascending order.\n");
}
else{
bubble(a,SIZE,descending);
printf( "\nNumbers in descending order.\n");
}