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 586823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:08:49+00:00 2026-05-13T15:08:49+00:00

Are there machines (or compilers), where sizeof(char) != 1 ? Does C99 standard says

  • 0

Are there machines (or compilers), where sizeof(char) != 1?

Does C99 standard says that sizeof(char) on standard compliance implementation MUST be exactly 1? If it does, please, give me section number and citation.

Update:
If I have a machine (CPU), which can’t address bytes (minimal read is 4 bytes, aligned), but only 4-s of bytes (uint32_t), can compiler for this machine define sizeof(char) to 4? sizeof(char) will be 1, but char will have 32 bits (CHAR_BIT macros)

Update2:
But sizeof result is NOT a BYTES ! it is the size of CHAR. And char can be 2 byte, or (may be) 7 bit?

Update3:
Ok. All machines have sizeof(char) == 1. But what machines have CHAR_BIT > 8 ?

  • 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-13T15:08:49+00:00Added an answer on May 13, 2026 at 3:08 pm

    It is always one in C99, section 6.5.3.4:

    When applied to an operand that has
    type char, unsigned char, or signed char, (or a qualified version thereof)
    the result is 1.

    Edit: not part of your question, but for interest from Harbison and Steele’s. C: A Reference Manual, Third Edition, Prentice Hall, 1991 (pre c99) p. 148:

    A storage unit is taken to be the
    amount of storage occupied by one
    character; the size of an object of
    type char is therefore 1.

    Edit: In answer to your updated question, the following question and answer from Harbison and Steele is relevant (ibid, Ex. 4 of Ch. 6):

    Is it allowable to have a C
    implementation in which type char can
    represent values ranging from
    -2,147,483,648 through 2,147,483,647? If so, what would be sizeof(char)
    under that implementation? What would
    be the smallest and largest ranges of
    type int?

    Answer (ibid, p. 382):

    It is permitted (if wasteful) for an
    implementation to use 32 bits to
    represent type char. Regardless of
    the implementation, the value of
    sizeof(char) is always 1.

    While this does not specifically address a case where, say bytes are 8 bits and char are 4 of those bytes (actually impossible with the c99 definition, see below), the fact that sizeof(char) = 1 always is clear from the c99 standard and Harbison and Steele.

    Edit: In fact (this is in response to your upd 2 question), as far as c99 is concerned sizeof(char) is in bytes, from section 6.5.3.4 again:

    The sizeof operator yields the size
    (in bytes) of its operand

    so combined with the quotation above, bytes of 8 bits and char as 4 of those bytes is impossible: for c99 a byte is the same as a char.

    In answer to your mention of the possibility of a 7 bit char: this is not possible in c99. According to section 5.2.4.2.1 of the standard the minimum is 8:

    Their implementation-defined values shall be equal or greater [my emphasis] in magnitude to those shown, with the same sign.

    — number of bits for smallest object that is not a bit-field (byte)

    CHAR_BIT 8

    — minimum value for an object of type signed char

    SCHAR_MIN -127

    — maximum value for an object of type signed char

    SCHAR_MAX +127

    — maximum value for an object of type unsigned char

    UCHAR_MAX 255

    — minimum value for an object of type char

    CHAR_MIN see below

    — maximum value for an object of type char

    CHAR_MAX see below

    […]

    If the value of an object of type char
    is treated as a signed integer when
    used in an expression, the value of
    CHAR_MIN shall be the same as that of
    SCHAR_MIN and the value of CHAR_MAX
    shall be the same as that of
    SCHAR_MAX. Otherwise, the value of
    CHAR_MIN shall be 0 and the value of
    CHAR_MAX shall be the same as that of
    UCHAR_MAX. The value UCHAR_MAX
    shall equal 2CHAR_BIT − 1.

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

Sidebar

Related Questions

When I defragment my XP machine I notice that there is a block of
There is a conversion process that is needed when migrating Visual Studio 2005 web
We have built a Windows Service that is running on client's machines, which occasionally
I'm attempting to install GCC 4.5.1 on my Apache server, but it says there
Heres the problem. I use around three different machines for development. My partner is
Is there a cookie automatically placed on the user's machine? Or is it somehow
Is there a clean and OS independent way to determine the local machine's IP
Is there an easy way of finding out the host name of a machine
My Virtual Machine's clock drifts pretty significantly. There's documentation out there about dealing with
There are two weird operators in C#: the true operator the false operator If

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.