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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:33:06+00:00 2026-05-25T19:33:06+00:00

I was reading in the C99 standard about the usual arithmetic conversions. If both

  • 0

I was reading in the C99 standard about the usual arithmetic conversions.

If both operands have the same type, then no further conversion is
needed.

Otherwise, if both operands have signed integer types or both have
unsigned integer types, the operand with the type of lesser integer
conversion rank is converted to the type of the operand with greater
rank.

Otherwise, if the operand that has unsigned integer type has rank
greater or equal to the rank of the type of the other operand, then
the operand with signed integer type is converted to the type of the
operand with unsigned integer type.

Otherwise, if the type of the operand with signed integer type can
represent all of the values of the type of the operand with unsigned
integer type, then the operand with unsigned integer type is converted
to the type of the operand with signed integer type.

Otherwise, both operands are converted to the unsigned integer type
corresponding to the type of the operand with signed integer type.

So let’s say I have the following code:

#include <stdio.h>

int main()
{
    unsigned int a = 10;
    signed int b = -5;

    printf("%d\n", a + b); /* 5 */
    printf("%u\n", a + b); /* 5 */
    return 0;
}

I thought the bolded paragraph applies (since unsigned int and signed int have the same rank. Why isn’t b converted to unsigned ? Or perhaps it is converted to unsigned but there is something I don’t understand ?

Thank you for your time 🙂

  • 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-25T19:33:07+00:00Added an answer on May 25, 2026 at 7:33 pm

    0x0000000a plus 0xfffffffb will always be 0x00000005 regardless of whether you are dealing with signed or unsigned types, as long as only 32 bits are used.

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

Sidebar

Related Questions

I keep reading about C99 and C++11 and all these totally sweet things that
I have recently discovered existence of standard fastest type, mainly int_fast32_t and int_fast64_t .
Reading MSDN (and other sources) about custom report items (CRI) for reporting services 2005.
I was reading through K&R and i came across this example about uncertainty in
Reading through the CKEditor documentation , I see that they have an option to
Reading Chomsky hierarchy ... ... I know regexp can't parse type-2 grammars (context-free grammars),
Reading or writing a C code, I often have difficulties translating the numbers from
Setup I have a few questions about the default argument promotions when calling a
Reading about the lack of persistence ignorance in Entity Framework I often stumble upon
reading the docs i see that the glGetTexImage2d() function has a 'type' parameter. The

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.