Increase size of global multidimensional array

This is a discussion on Increase size of global multidimensional array within the C Programming forums, part of the General Programming Boards category; I have a need to create a global multidimensional array of unknown size (size is determined later in the program). ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    62

    Increase size of global multidimensional array

    I have a need to create a global multidimensional array of unknown size (size is determined later in the program). My questions are:
    1. How should I declare it initially
    2. How do I later in my program actually tell it how large it needs to be?

    It will contain the names of files.
    Thanks

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,687
    Search the board - it's a popular question.
    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.

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    Are you familiar with malloc() or new?

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    New is C++, not C.


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    Read Dynamic memory allocation concept in your C programming book or Check out over the net or do a board search Search Board

    ssharish2005

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 05-29-2009, 05:48 AM
  2. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  3. increase array size?
    By rodrigorules in forum C Programming
    Replies: 3
    Last Post: 09-18-2005, 12:15 PM
  4. Replies: 42
    Last Post: 12-19-2004, 07:59 AM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM

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