Help using a character as parameter
I have a multiple choice function below that is part of a larger program but I am having trouble having it operate with characters as inputs and arguments. It has to be a character input, but I kinda want it to act like an integer, how do i do that?
Code:
void addition(int *Preward) //function that is called by the users selection
{ int random1, random2; int order; int one, two, three; int rando1, rando2; char a, b, c; // ERROR char userselect; //ERRRORR srand(time(NULL)); //generates fresh numbers each time. random1 = 1+(rand()%99); // from 1-99 random2 = 1+(rand()%99); // from 1-99 rando1 = 2+(rand()%198); // 2 to 198 rando2 = 2+(rand()%198); // 2 to 198 order = 1+(rand()%3); switch(order){ case 1: printf("\n%d + %d = ", random1, random2); one = (random1+random2); two = (rando1); three = (rando2); printf("\n select from the following\n a) %d b) %d c) %d\n", one, two, three); scanf("%c", &userselect); //ERROR if (userselect == a){ //ERROR printf("Congratulations\n\n"); *Preward = 1; } else{ printf("incorrect, correct answer is a\n\n"); }break;