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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:58:52+00:00 2026-06-05T15:58:52+00:00

I was told by an experienced programmer(spoj,codechef,topcoder etc ) than as a general rule

  • 0

I was told by an experienced programmer(spoj,codechef,topcoder etc ) than as a general rule one can use int for values upto 10^9.

What is the general rule for using
signed long int,
unsigned long int,
signed long long int,
unsigned long long int

  • 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-05T15:58:53+00:00Added an answer on June 5, 2026 at 3:58 pm

    It depends on your portability constraints. Formally, an int is only
    guaranteed to support values in the range [-32767,32767], so anytime
    you need more, you should use long. Practically, a lot of programs
    don’t need portability to 16 bit machines (which are very rare today),
    and on most modern 64 bit platforms, long will be 64 bits, which is
    more than is needed, and will slow things down (if only because of
    poorer locality). If you can assume int is at least 32 bits, that’s
    what you should use pretty much everywhere, with the following
    exceptions:

    • If you’re concerned with the actual bitwise representation, using bitwise &, |, ^ and ~, or the shifting operators, then you should use unsigned types, unsigned int by default, but other sizes if one of the following cases occurs.

    • If you need the modulo arithmetic of unsigned, use an unsigned type. This is very, very rare, but does occur in things like calculating hash
      codes.

    • If you have really large tables (vectors or any other contiguous representation), you might consider short or even signed char (or unsigned short or unsigned char, if you’re concerned with the bitwise representation). I would not use plain char for anything but characters, since its signedness is implementation defined.

    • If you need to represent values greater than 2^31, then consider long long. (Often, however, even long long won’t be big enough in such cases, and you’ll need some sort of BigInteger class.)

    As a general rule, anything but int should be the exception.

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

Sidebar

Related Questions

I was told that a function defined as static in one .c file is
I was told that the optimal way to program in C++ is to use
Im a pretty experienced programmer in PHP and mainly web languages but today i
Someone told me once, that programmers tend to learn one scripting language properly and
I'm by no means an experienced programmer. This task I have is very likely
Today, I was just told about the seed() function from a programmer much more
I am a programmer at a financial institute. I have recently been told to
I was about to use Firebird for a project, when someone told that DB2
We have been told that we have to use a piece of software called
I want to use JQuery Mobile to create an html page. As they told

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.