Who determines the ordering of characters

前端 未结 6 1905
轻奢々
轻奢々 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 03:46

    It is determined by whatever the execution character set is.

    In most cases nowadays, that is the ASCII character set, but C has no requirement that a specific character set be used.

    Note that there are some guarantees about the ordering of characters in the execution character set. For example, the digits '0' through '9' are guaranteed each to have a value one greater than the value of the previous digit.

提交回复
热议问题