Literal single quote char
Hi, I'm hoping someone might be able to help me with what I think might be a simple problem.
I have came across the need to add to an unsigned char array a literal single quote "'"
My question is how can I achieve that?
unsigned char uArray[4];
uArray[0] = 'I';
uArray[1] = 't';
uArray[2] = '''; // here is where my problem lies
uArray[3] = 's';
The quote I need to insert, is closing the opening quote.
I appreciate any help offered.
(edit)
Sorry if you wasted time reading this, I found solution.
I guess sometimes I need to write a question down before the answewr comes to me.
uArray[2] = 39;
Thank you.
Solved.
54 Minutes
Discussion Span
Suzie999
Posting Whiz
322 posts since Jul 2010
Reputation Points: 49
Solved Threads: 15
Skill Endorsements: 0
Question Self-Answered as of 9 Months Ago
It's good that you found something that worked. However, you may be interested in finding out more about escape sequences, which allow you to use:
uArray[2] = '\''; // single quote + backslash + single quote + single quote
There are others, besides this one for the single quotation mark, such as:
\" for double quotation mark
\? for question mark
and a double backslash to represent the backslash
One of the most common that people come across is \n for newline, perhaps not realising that it belongs to a group of such escape sequences. A quick search on Google with give you a list of them.
Bob
using namespace Bob
221 posts since Feb 2003
Reputation Points: 30
Solved Threads: 11
Skill Endorsements: 0
Of course, I'm such a dimwit at times :(
I even used the escape to add a terminator '\0'.
Duh!
Thanks for the heads up.
Suzie999
Posting Whiz
322 posts since Jul 2010
Reputation Points: 49
Solved Threads: 15
Skill Endorsements: 0
Of course, I'm such a dimwit at times :(
Who isn't? No worries.
Bob
using namespace Bob
221 posts since Feb 2003
Reputation Points: 30
Solved Threads: 11
Skill Endorsements: 0