Thread: integer array of size 17000

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

    integer array of size 17000

    hi ,
    i need to create an array of long integers containing 17000 elements.how do i do it? can anyone help?
    thanks,pearl
    Last edited by Pearl; 08-13-2004 at 01:54 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    long int array[17000];

    If that's what you tried and it didn't work, then try mentioning which OS/Compiler or whatever other useful information you may have.
    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.

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Did you try it and get an error from your compiler? What did the error say?

    If you try to allocate arrays of very large size within a function you will often get errors because each function has a limited stack size. You can either try to allocate the array as a global, or you can have a pointer variable within your function and attempt to allocate memory for that array dynamically with a malloc call.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Little Array Difficulty
    By G4B3 in forum C Programming
    Replies: 16
    Last Post: 03-19-2008, 12:59 AM
  2. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  3. How do you use variable to initialize array size?
    By yougene in forum C Programming
    Replies: 11
    Last Post: 09-04-2007, 02:50 PM
  4. Representing a Large Integer with an Array
    By random_accident in forum C Programming
    Replies: 3
    Last Post: 03-03-2005, 08:56 PM
  5. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 08:31 AM