[Solved] Issue in taking character input to C program

[ad_1]

You can’t use strcasecmp to compare characters. It’s not completely wrong, but a single character is not a properly terminated string.

If you must do comparison this way, use strncasecmp:

if(strncasecmp(&gender,&word_M, 1) == 0)

That will limit it to comparing one character.

Also, your retry loop doesn’t check for ‘F’, but checks ‘M’ twice.

[ad_2]

solved Issue in taking character input to C program