Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Islam and memory allocation!

Status
Not open for further replies.

ebuBekir

Technical User
Sep 6, 2001
22
DE
Hi @ All !
My deepest sympathy to all those in the USA! Please, do not think wrong about Moslems. No terrorist can be a Moslem!

In the Islam any person, who kills an innocent person, is as guilty as killing all the mankind!
So, how could a terrorist be a Moslem?

By the way, I have still problems with C++. I can neither allocate space nor deallocate it for a two dimensional array.
Could you please help me?


MfCenter2D *aCenter2D = new MfCenter2D [SIZE];


MfCenter2D(*aCenter2D) = new MfCenter2D [10]

for ( j = 0; j <= 10; j++ )
delete [] aCenter2D;

Thanks for reading and all your help!
 
Thank you for you kind comment.


Here is how to dynamically allocate and free a 2 dimensional array in C++:

// Dimensions can be defined at compile time
// or run time, it does not matter as long as
// they are int

const int NumRows = 100;
const int NumCols = 10;

// 2 dimensional array
int **m;

// Allocate an array of row pointers
// then allocate each row pointer

m = new int *[NumRows];
for (int j = 0; j < NumRows; j++)
m[j] = new int[NumCols];


// Be sure to delete when done

for (int j = 0; j < NumRows; j++)
delete [] m[j];

delete [] m;


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top