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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:46:46+00:00 2026-05-24T12:46:46+00:00

I what to know that what is the base on which the size of

  • 0

I what to know that what is the base on which the size of any datatype is decided. For eg. size of intger datatype in java is 4 bytes. So why its exactly 4 and not anything else. More over maximum number that can be stored with int type is 2,147,483,648. When this number come from? I mean what is the formula to get this number for anyother data type?

But why it is exactly 4? I still not clear. Some says that to represent any number in the range of perticular datatype. But there are other dataypes also which provide larger range. Still so much confused…

  • 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-24T12:46:46+00:00Added an answer on May 24, 2026 at 12:46 pm

    In assembler size in bits of the types is defined by the architecture that has to work with the numbers. Most current architectures group bits in 8-bit bytes, and double the size of the number when going to the next type: 8, 16, 32, 64, 128… but not all architectures support all the types, and some old architectures had weird types (14 bit integers, for example).

    When you use a programming language, the language abstracts the lower levels, and the types in the language are defined to abstract the lower level types. Depending on the language the types might differ: char, short int, int some proposed short, tall, grande. In some cases it will be exactly defined (in Java or C# an int is exactly 32bits, and a long is 64bits), while in others like C/C++ only the relationships among the types are defined (long is not smaller than int which in turn is not smaller than short, then char…)

    The maximum number that a given unsigned type can hold can be calculated as 2^N-1, so for a 32 bit unsigned int, the maximum value is 4294967295. The reason for the -1 part is that there are 2^N distinct numbers, one of which is 0, so only 2^N-1 are left for non-zero values.

    When it comes to signed integer types, again the architecture has much to say. Most current architectures use two’s-complement. In those platforms the highest signed value for an N bit signed integer will be 2^(N-1)-1 and the most negative number will be -2^(N-1). Some older architectures reserved one bit for the sign and then stored the actual number, in which case the negative range would be reduced by one (this approach allows for two zero values: 0 and -0).

    As to your question, you will have to pick the language first. Then, in the case of C or C++, you will have to pick your platform, and even the compiler. While in most cases the types are directly related (int is 32 bits in most 32 and 64bit architectures in C++), that is not guaranteed, and some types might differ (long might represent a 32 or 64bit integer type). As of the actual size of a type in C++ besides char that is guaranteed to have CHAR_BITS bits, you can use sizeof(type)*CHAR_BITS to get the size in bits.

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

Sidebar

Related Questions

Yes, I know that downcast using dynamic_cast can't compile if the Base is not
I know that Java have its own garbage collection, but sometimes I want to
I know that an MVC framework allows you to separate business logic, data base
I know that immutable objects always have the same state, the state in which
I know that there are a lot of questions and answers exactly about this
I know that the base different is that setId() takes int as a parameter,
I know that Phonegap has an event for back button, but it's only available
I know that this sort of question has been asked here before, but still
I know that if port 443 is open that means the remote host supports
I know that when I use range([start], stop[, step]) or slice([start], stop[, step]) ,

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.