0

What is escape character?

meaning of escape character

30th Jul 2017, 9:45 AM
Tanya Kathuria
Tanya Kathuria - avatar
2 odpowiedzi
+ 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).
30th Jul 2017, 10:20 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
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
30th Jul 2017, 10:16 AM
Matte
Matte - avatar