0

What is the different between ". " And '. ' in c++?

11th Oct 2017, 6:21 PM
Prateek Gupta
Prateek Gupta - avatar
5 Respuestas
+ 18
"." is a string containing a single dot character. '.' is a single dot character. ". " is a string containing a single dot character and a space after that. '. ' is a single dot character and a space after that which is illegal.
11th Oct 2017, 6:24 PM
Babak
Babak - avatar
+ 12
Thank you Mr. JPM7 for your endless support. @~)~~~~
12th Oct 2017, 8:32 AM
Babak
Babak - avatar
+ 2
You have 4 characters in each string*. One is stored in little endian byte order, the other in YOUR byte order: https://code.sololearn.com/c3cS3hJbHs0i/?ref=app * edit: by which I mean 'string literal' and 'character literal' [re: JPM7]
11th Oct 2017, 11:18 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
@JPM7 I can't remember the last time I touched a big-endian system -- no trivial detail, though I suspect some SoloLearners have such systems -- but I did surprise some malware experts by offering Windows binaries can have their 'magic numbers' be 'MZ' and 'ZM'. . ~Later I was decoding TCP/IP headers and that work *is* big-endian (network order, for readers) ... but I didn't dig into it specifically ... except when malware messed it up :) , so thanks for all the links. Edited earlier post to clarify "string-" vs 'character literal'.
12th Oct 2017, 1:53 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
@JPM7 ... Do you happen to know if character literals can be 8 bytes when gcc is in 64-bit mode (vs. the 4bytes / 32 bits here)? (I kind of thought it was related to Unicode maximums but that's just speculation. I'll read your links in case the answer's there)
12th Oct 2017, 2:02 PM
Kirk Schafer
Kirk Schafer - avatar