how to stop scanf from adding a new line in c

Solutions on MaxInterview for how to stop scanf from adding a new line in c by the best coders in the world

showing results for - "how to stop scanf from adding a new line in c"
Ana
28 Jun 2017
1For a simple solution, you could add a space before the format specifier when you use scanf(), for example: scanf(" %c", &ch); The leading space tells scanf() to skip any whitespace characters (including newline) before reading the next character, resulting in the same behavior as with the other format specifiers.