longer than a long int?

This is a discussion on longer than a long int? within the C++ Programming forums, part of the General Programming Boards category; I have just come across a problem in my code. Im using 11 digit numbers in my program: ie 10000000001 ...

  1. #1
    fry
    fry is offline
    Registered User fry's Avatar
    Join Date
    Mar 2002
    Posts
    128

    longer than a long int?

    I have just come across a problem in my code. Im using 11 digit numbers in my program: ie 10000000001

    I have had things go wrong in my code, and realised that i had exceeded the max length of an int. And a long int is too small as well.

    Is there a simple way to create a variable that can store a number this large? The number may get to 12 or 13 digits long.
    IDE: Dev C++ 5
    Lib: Allegro
    OS: Windows 2000

  2. #2
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Well any numerical type with support for larger numbers is going to be compiler specific. (__int64 on microsoft compilers)
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571

    Re: longer than a long int?

    Originally posted by fry
    I have just come across a problem in my code. Im using 11 digit numbers in my program: ie 10000000001

    I have had things go wrong in my code, and realised that i had exceeded the max length of an int. And a long int is too small as well.

    Is there a simple way to create a variable that can store a number this large? The number may get to 12 or 13 digits long.
    If you're writing Windows code you could always use LARGE_INTEGER structure. Look it up it will give you 64bits wheter you like it or not.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 01:05 PM
  2. Replies: 2
    Last Post: 03-24-2006, 08:36 PM
  3. Converted from Dev-C++ 4 to Dev-C++ 5
    By Wraithan in forum C++ Programming
    Replies: 8
    Last Post: 12-03-2005, 07:45 AM
  4. Switch/case Problems (long code in post)
    By Wraithan in forum C++ Programming
    Replies: 2
    Last Post: 12-01-2005, 06:40 PM
  5. easy if you know how to use functions...
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 01-31-2002, 07:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21