See what's going on with flipcode!




This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.

 

  Viewing Dynamically Allocated Arrays In VC++
  Submitted by



Normally when you allocate an array using new or malloc in VC++ when you look at the variable in the watch window you can only see the first element. To view the entire array just type the <variable-name>, <number-of-elements-to-view>.

Example:

void main( void )
{
	const int SIZE = 10;
	int *intArray = 0;

intArray = (int *)malloc( sizeof( int ) * SIZE ) ;

for( int x = 0; x < SIZE; x++ ) { intArray[x] = 10 + x; } }



to see intArray in the watch window type

intArray, SIZE

and it will expand out for the entire array


The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.

 

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.