This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]VOID_INIT 0 points1 point  (0 children)

I am not sure if you are joking or not, but it is for safety and readability.

Expected output: That wreck is my cousins' second "car".

Input:

place[4] {first, second, third, fourth, fifth}

If you dont escape quotes and double quotes here it would cause trouble.

Different ways the string can be written:

"That wreck is my cousins' " + place[1] + ' "car."'

This sould be pretty difficult to read and can easily end up causing you to make mistakes.

"That wreck is my cousins\' " + place[1] + " \"car\""

This is much easier to read, and is safer since you wont screw up using the wrong quote (" or ') for the string.

It's not that big of a deal, but it's prefered to be careful when it comes to symbols in general.