Ive been searching far and wide for the answer but havent been able to come op with a viable solution. As you can see in my code beneath, I'am trying to pass the value of choice into get_user_input(char *input). I think this is what i want to do because i need the function scanf to be called inside get_user_input(char *input).
I'am fairly new to programming and have alot of trouble trying to understand pointers and references
I hope someone could help me out!
The get_user_input(char input) function
void get_user_input(char *input) {
*input = '\0' ;
scanf(" %c", input);
}
Trying to call scanf() from the function get_user_input(char input)
void manual_read_sensors(void) {
while (1) {
// Ask the user for which sensor to read.
printf("Which sensor do you want to read?\n"
"(i)ntensity\n"
"(a)ngle\n"
"(t)ime\n"
"(s)unscreen\n"
"(q)uit\n"
"Enter choice: ");
void choice = get_user_input(); <----- Trying to call
// Return to the main menu again.
if (choice == 'q')
break;