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

  • SEARCH
  • Home
  • 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 7960191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:41:23+00:00 2026-06-04T04:41:23+00:00

When is it ever the case that a signed integer cannot represent all the

  • 0

When is it ever the case that a signed integer cannot represent all the values of the original type with regards to integer promotion?

From the text K&R, C Programming Language, 2nd Ed. p. 174

A.6.1 Integral Promotion

A character, a short integer, or an integer bit-field, all either signed or not, or an object of enumeration type, may be used in an
expression wherever an integer may be used. If an int can represent
all the values of the original type, then the value is converted to
int; otherwise the value is converted to unsigned int
. This process
is called integral promotion.

This code shows the limits of the types for my system:

#include <stdio.h>
#include <limits.h>

int main(void)
{

    printf("CHAR_MAX: %i\n", CHAR_MAX);     
    printf("UCHAR_MAX: %i\n", UCHAR_MAX);

    printf("SHORT_MAX: %i\n", SHRT_MAX);        
    printf("USHORT_MAX: %i\n", USHRT_MAX);

    printf("INT_MAX: %i\n", INT_MAX);       
    printf("UINT_MAX: %u\n", UINT_MAX);

    return 0;
}

The result is:

CHAR_MAX: 127
UCHAR_MAX: 255
SHORT_MAX: 32767
USHORT_MAX: 65535
INT_MAX: 2147483647
UINT_MAX: 4294967295

The signed int type is way bigger than any of the other types, so when would it ever fall back to UINT_MAX?

  • 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-06-04T04:41:25+00:00Added an answer on June 4, 2026 at 4:41 am

    It’s possible for a short int to be the same size as an int, so an unsigned short int could not be promoted to an int, for example. This just isn’t the case on your compiler.

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

Sidebar

Related Questions

I used an application recently that was awe-inspiring. All the forms inherited from their
That is, is there ever a case where a domain model should be available
Is there ever a case where a comparison ( equals() ) between two floating
Ever since deleting the original settings.settings file I have had endless problems getting the
From what I've read, code obfuscation isn't really that hard to crack, and it
I am working on an app that imports photos from facebook. It creates a
There is a process that runs ever hour that has to insert into table1
I have a PHP page that is bringing in results from a Database and
Ever since I upgraded to Delphi 2009, I am having terrible experience with TFrame
Ever since I gained experience at a software house I have found it difficult

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.