Who determines the ordering of characters

前端 未结 6 1906
轻奢々
轻奢々 2020-12-19 03:17

I have a query based on the below program -

char ch;
ch = \'z\';
while(ch >= \'a\')
{
    printf(\"char is  %c and the value is %d\\n\", ch, ch);
    ch =         


        
6条回答
  •  一生所求
    2020-12-19 04:03

    I answer you too late but apart from what was already said I want to add a little.

    At the 5th translation phase (part of the preprocessor) each member of the source character set is converted to the corresponding character of the execution character set. Quote from ISO 9899, 5.1.1.2p5

    1. Each source character set member and escape sequence in character constants and string literals is converted to the corresponding member of the execution character set; if there is no corresponding member, it is converted to an implementation-defined member other than the null (wide) character. 7)

    There is no need for the source char set to be the same as the execution char set ; as others say, if the execution char set is EBCDIC of IBM's mainframe, the logic is not the same as in the case of ASCII character set.

提交回复
热议问题