http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

TheGrumpyProgrammer



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dynamic Arrays



Hey-

I use dynamic arrays all the time for maps, objects, whatever.

Instead of using an array like this:
char array[20];

You can do this:
char * array;
array = new char[value];

I think this method only works in C++ though...

Anyway, later on if you need a different sized array, you can just do this 
to change it:
array = new char[value + 5];

The way to do this in C is with the malloc command, but I really like the 
new command better.

Hope that answered your question.

-Brian
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.

=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html