0
What is escape character?
meaning of escape character
2 Réponses
+ 6
It is a special character, usually '\', used before other character which are meaningful to neutralize their special meaning.
For example, if you want to declare a string, you use double quotes - "This is a string". But if you want your string to contain double quotes as regular characters, you have to escape them.
"She said: \"My bad!\" and turned back."
If you didn't escape them, the string would be:
"She said: " and all characters after that would be ignored (or most likely would raise an exception).
0
its a character like \n or \'
they are useful to write particular things in the output, for example \n represent a new line, \' allows you to write the character '
in fact characters like this could be confused with commands, so the escape sequence allows you to write them without any confusion
https://en.m.wikipedia.org/wiki/Escape_sequences_in_C?wprov=sfla1