I have a variable where the user inputs one number. That variable is of type int
because that's the return value of fgetc(stdin)
and getchar()
. In this case, I'm using fgetc(stdin)
. After the user inputs the number, I would like to convert it to an integer with strtol()
, however, I get a warning about an incompatible integer to pointer conversion because of strtol()
's first argument being a const char *
. Here is the code:
int option;
char *endptr;
int8_t choice;
printf("=========================================Login or Create Account=========================================\n\n");
while(1) {
printf("Welcome to the Bank management program! Would you like to 1. Create Account or 2. Login?\n>>> ");
fflush(stdout);
option = fgetc(stdin);
choice = strtol(option, &endptr, 10);
Does anyone know how to get around this?