Thread: Max size of an INT

  1. #1
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681

    Max size of an INT

    complier is Dev-C++ Ver 4.
    Just wondering if anyone knew the max size of a regular int with this complier?

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    thanks

  3. #3
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    Originally posted by Thantos
    thanks
    it depends from compiler to compiler (and also the system).. for example in DOS based 16 bit.. it is smaller than windows based.. you can use MAX_INT in limits.h

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    >you can use MAX_INT in limits.h

    I think you mean INT_MAX.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >you can use MAX_INT in limits.h
    INT_MAX, not MAX_INT

    >it depends from compiler to compiler (and also the system)..
    Actually, it depends primarily on the system. C is designed to be very fast, which basically means that compiler writers are free to use the machine's natural word size for int instead of changing things in the compiler to meet language requirements. If the machine has 16 bit words, the compiler will use 16 bit words, if the machine has 32 bit words, the compiler will use 32 bit words all in the name of efficiency and simplicity on the compiler writer's part.
    My best code is written with the delete key.

  6. #6
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    Originally posted by Prelude
    >you can use MAX_INT in limits.h
    INT_MAX, not MAX_INT

    >it depends from compiler to compiler (and also the system)..
    Actually, it depends primarily on the system. C is designed to be very fast, which basically means that compiler writers are free to use the machine's natural word size for int instead of changing things in the compiler to meet language requirements. If the machine has 16 bit words, the compiler will use 16 bit words, if the machine has 32 bit words, the compiler will use 32 bit words all in the name of efficiency and simplicity on the compiler writer's part.
    thanx... i thought the compilers were built based on the system ..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to combine these working parts??
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 02-01-2009, 08:19 AM
  2. Replies: 1
    Last Post: 10-27-2006, 01:21 PM
  3. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  4. problem with sorting
    By pinkpenguin in forum C Programming
    Replies: 2
    Last Post: 11-18-2005, 11:06 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM