In C++, we were investigating the single quotation mark (' ) (it was about the content that would change to a number if a string was in the single quotation mark) http://hashcode.co.kr/questions/237/ Small Quotes-In-Character-Multiple-Writing-Case I saw the word "multi character literature" in...It's hard to find a description of the word, so I'm posting a question.
I would like to know what multi character literal means in C++ and where it is used.
c++
'abcde'
If you put several chars between these small quotes, it's called multicharacter literal and int type. By the way, it has implementation-defined value.
It means that each compiler has a different value.
test
appears as 1952805748, which seems to work only with certain compilers.
I don't know why you created such a function, but I think it's better not to use a function that can have different values for each compiler.
IBM Knowledge Center - Character Literals has this description.
A character literal contains a sequence of characters or escape sequences enclosed in single quotation mark symbols, for example 'c'. A character literal may be prefixed with the letter L, for example L'c'. A character literal without the L prefix is an ordinary character literal or a narrow character literal. A character literal with the L prefix is a wide character literal. An ordinary character literal that contains more than one character or escape sequence (excluding single quotes ('), backslashes () or new-line characters) is a multicharacter literal.
C++A character literal that contains only one character has type char, which is an integral type. A multicharacter literal has type int.
In short, character literal is a sequence of characters or escapes enclosed in single quotes. In C++, character literature is char type, and multicharacter literature is int type.
© 2024 OneMinuteCode. All rights reserved.