Dynamic Arrays?

This is a discussion on Dynamic Arrays? within the C Programming forums, part of the General Programming Boards category; *sigh* I hate being a newbie. How would one create dynamic arrays? The particular use is this: Loading a map ...

  1. #1
    Professional Chef leeor_net's Avatar
    Join Date
    Apr 2004
    Location
    Charles Town, WV
    Posts
    147

    Unhappy Dynamic Arrays?

    *sigh* I hate being a newbie.

    How would one create dynamic arrays?

    The particular use is this:

    Loading a map file. Read in the width and height of a 2D matrix. Reallocate the map array to the new size.

    Or, would it just be easier to create a maximum size (let's say 2000 for now) and just read the X, Y coords defined in the map file?

    Leeor...
    - Leeor

  2. #2
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    Look into pointers , malloc, realloc , etc.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  3. #3
    Professional Chef leeor_net's Avatar
    Join Date
    Apr 2004
    Location
    Charles Town, WV
    Posts
    147
    Cool. Thanks!

    Leeor...
    - Leeor

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating and freeing dynamic arrays
    By circuitbreaker in forum C++ Programming
    Replies: 8
    Last Post: 02-18-2008, 11:18 AM
  2. Replies: 16
    Last Post: 01-01-2008, 04:07 PM
  3. processing dynamic arrays
    By Mario F. in forum C++ Programming
    Replies: 9
    Last Post: 06-04-2006, 12:32 PM
  4. Dynamic (Numeric) Arrays
    By DavidB in forum C++ Programming
    Replies: 5
    Last Post: 05-03-2006, 08:34 PM

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