Why aren't scanf(“%*[^\\n]\\n”); and scanf(“%*[^\\n]%*c”); clearing a hanging newline?
After a call to scanf("%d", &variable); we are left with a newline hanging at the stdin , which should be cleared before a call to fgets , or we end up feeding it a newline and making it return prematurely. I've found answers suggesting using scanf("%*[^\n]%*c"); after the first call to scanf to discard the newline and others suggesting using scanf("%*[^\n]\n"); . Theoretically, both should work: The first would consume everything that isn't a newline (but not including the newline itself) and then consume exactly one character (the newline). The second would consume everything that isn't a