large array

This is a discussion on large array within the C Programming forums, part of the General Programming Boards category; hi friends,i need to create an array of long ints with size 17000.i tried using long int arr[17000] in turbo ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    2

    large array

    hi friends,i need to create an array of long ints with size 17000.i tried using long int arr[17000] in turbo c but i get an error saying array size too large. upto 10000 elements i do not get any error. can anyone please help?i want to use this array as a memory so that i can store data and retrieve data by specifying the index of the array...

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,801
    Why do you need to create an array of that size?
    Last edited by prog-bman; 08-24-2004 at 11:56 PM.
    Woop?

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Well you can try: Using static, or allocating the memory dynamically using malloc

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,443
    > i tried using long int arr[17000] in turbo c
    For heavens sake get a better compiler!!!
    64K is the max size of any single object with that stone age fossil

    sizeof(long int) == 4 (probably)
    17000 * 4 > 64K (oops, you lose!)

    Please don't tell me your OS is XP, because that's just like buying a nice new ferrari, and replacing the engine with a 200 year old steam engine.
    Talk about crippleware!

    And I bet you agonised over whether your machine was up to spec for sound and graphics.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    ~viaxd() viaxd's Avatar
    Join Date
    Aug 2003
    Posts
    246
    Salem is right, and i've tested, gcc compiles ar[17000] fine.
    :wq

  6. #6
    ---
    Join Date
    May 2004
    Posts
    1,379
    i really want to know why people are still using old compilers on new systems? (assuming he is using a new system, but if he isnt then he should know old systems cant use more than 64k?)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question about multidimensional arrays
    By richdb in forum C Programming
    Replies: 22
    Last Post: 02-26-2006, 08:51 AM
  2. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  3. Representing a Large Integer with an Array
    By random_accident in forum C Programming
    Replies: 3
    Last Post: 03-03-2005, 07:56 PM
  4. Template Array Class
    By hpy_gilmore8 in forum C++ Programming
    Replies: 15
    Last Post: 04-11-2004, 11:15 PM
  5. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 08:31 AM

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