Thread: New to C Programming, need help with a nesting loop

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #13
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    In C, character constants are of type int, as you've shown.
    Question 8.9

    However, the char data type is sufficient for handling basic characters:

    Quote Originally Posted by C11-draft
    6.2.5 Types

    ...

    3 An object declared as type char is large enough to store any member of the basic execution character set. If a member of the basic execution character set is stored in a char object, its value is guaranteed to be nonnegative. If any other character is stored in a char object, the resulting value is implementation-defined but shall be within the range of values that can be represented in that type.
    But more specifically, I was taking issue with your use of numeric values in lieu of character literals. Computers may use different character sets, so 65 may not always correspond to 'A'. It is good practice to strive for portability whenever possible.
    Last edited by Matticus; 09-28-2017 at 08:02 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Structures nesting
    By justine in forum C Programming
    Replies: 3
    Last Post: 11-26-2012, 06:25 AM
  2. Nesting classes
    By DarkAlex in forum C++ Programming
    Replies: 4
    Last Post: 03-29-2009, 08:58 PM
  3. Nesting switchstatments
    By Da-Nuka in forum C++ Programming
    Replies: 5
    Last Post: 03-04-2005, 03:05 PM
  4. Nesting
    By coo_pal in forum C Programming
    Replies: 1
    Last Post: 01-27-2003, 11:16 PM
  5. Nesting Parentheses
    By XZSNPP in forum C++ Programming
    Replies: 6
    Last Post: 01-18-2003, 10:01 PM

Tags for this Thread