Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 942305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:15:03+00:00 2026-05-15T22:15:03+00:00

I have a query based on the below program – char ch; ch =

  • 0

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 = ch-1;
}

Why is the printing of whole set of lowercase letters not guaranteed in the above program. If C doesn’t make many guarantees about the ordering of characters in internal form, then who actually does it and how ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:15:03+00:00Added an answer on May 15, 2026 at 10:15 pm

    The compiler implementor chooses their underlying character set. About the only thing the standard has to say is that a certain minimal number of characters must be available and that the numeric characters are contiguous.

    The required characters for a C99 execution environment are A through Z, a through z, 0 through 9 (which must be together and in order), any of !"#%&'()*+,-./:;<=>?[\]^_{|}~, space, horizontal tab, vertical tab, form-feed, alert, backspace, carriage return and new line. This remains unchanged in the current draft of C1x, the next iteration of that standard.

    Everything else depends on the implementation.

    For example, code like:

    int isUpperAlpha(char c) {
        return (c >= 'A') && (c <= 'Z');
    }
    

    will break on the mainframe which uses EBCDIC, dividing the upper case characters into two regions.

    Truly portable code will take that into account. All other code should document its dependencies.

    A more portable implementation of your example would be something along the lines of:

    static char chrs[] = "zyxwvutsrqponmlkjihgfedcba";
    char *pCh = chrs;
    while (*pCh != 0) {
        printf ("char is %c and the value is %d\n", *pCh, *pCh);
        pCh++;
    }
    

    If you want a real portable solution, you should probably use islower() since code that checks only the Latin characters won’t be portable to (for example) Greek using Unicode for its underlying character set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have SOQL query which queries for some records based on a where condition.
I have written a query to find similar ids based on tags from a
I have a simple query which is returning records based on the field status
I have a drop-down list which is generated based on the following sql query:
I have a combo box with a row source based on an SQL query
I have code which performs query on Jboss server. It has JNDI based datasource
I'm running an MySQL query that returns results based on location. However I have
I have rewritten the below based on the answers. I have a website that
I have a web based program which chooses some records from a database using
I have to build a query based on certain conditions. Is there a better

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.