home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
CGAZV5N3.ZIP
/
ARRTEST.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1991-03-02
|
683b
|
21 lines
//******* Listing 8 *********************** ARRTEST.CPP **
// ARRTEST.CPP : testing the dynamic array class
// (c) C Gazette. See Listing 1 for usage.
//********************************************************
#include "array.hpp"
#include <stdio.h>
void main() {
dynamic_array da(20);
for(int i = 0; i < 20; i++)
da[i] = i * 2; // assign a value to each element
dynamic_array* dap = new dynamic_array(20);
for(i = 0; i < 20; i++)
(*dap)[i] = i * 3;
for(i = 0; i < 20; i++)
printf("da[%d] = %d, (*dap)[%d] = %d\n", i, da[i], i, (*dap)[i] );
// must delete whatever you new:
delete dap;
da[20] = 100; // a test of the error system
}