0
What is the different between ". " And '. ' in c++?
5 Respostas
+ 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.
+ 12
Thank you Mr. JPM7 for your endless support. @~)~~~~
+ 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]
+ 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'.
+ 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)