Skip to content
Advertisement

Tag: c-strings

C segmentation fault on linux with strncmp

This works (‘Y’ must be single quotes): This gives segmentation fault: strncmp must be going off the deep end but not sure why since I’m passing a casted toupper() as (char *). Without the casting, same error. FYI user_input() is (N.B. vars are global): Thank you. Answer The return value of toupper is another character, not a pointer to a

Advertisement