Error: Invalid escape sequence in C | Common C program Errors
Sometimes, while writing Escape Sequences in C program, we mistakenly typed an invalid escape sequence, which does not give any error but does not give the expected result.
For example, if we want to print a "new line" between two words in a text and mistakenly typed \m instead of \n.
Consider the program:
Output
We wanted to print "Hello world" and "How are you?" in separate lines but there is an invalid escape sequence \m. Thus, the result is "Hello worldmHow are you?".
How to fix "Invalid escape sequence in C" error
To fix this and such errors, you should know about all escape sequences and use them properly.
Read: Escape sequences in C
Correct code
Output
need an explanation for this answer? contact us directly to get an explanation for this answer