[prog] Definining an array in Visual C++
Dan Richter
daniel.richter at wimba.com
Fri Mar 28 17:57:24 EST 2003
> CostStruct L_data[nSize][nSize];
If you're not familiar with vectors, you can use an array of arrays:
CostStruct** L_data = new CostStruct*[nSize];
for (int i=0; i<nSize; i++)
L_data[i] = new CostStruct[nSize];
Be careful to deallocate correctly (someone correct me if I'm wrong here):
for (int i=0; i<nSize; i++)
delete [] L_data[i];
delete [] L_data;
========== Dan Richter ============== mailto:Dan at wimba.com ===========
[Larry] Wall [inventor of Perl] believes that people think about
things in different ways, that natural languages accommodate many
mindsets, and that programming languages should too.
- Jon Udell, in his essay, "A Perl Hacker in the Land of Python"
More information about the Programming
mailing list