i want to implement a memory using c++ language.

the memory will contain addresses of length 64bits because in my architecture the word is 64 bits.

i want to implement it using a set associative array.

so i want to create a 2 dimensional array of dimension 8 and 16k bytes..

can anybody help :S:S:S? how do i create this 2 d array :S

Votes + Comments
You're double-posting !! (Double-post: http://www.daniweb.com/forums/thread181329.html)
8 Years
Discussion Span
Last Post by Zcool31

You could just use a pointer to a pointer, or a vector of vectors if you want your memory to dynamically readjust.


DWORD ** memory = new DWORD*[width_of_memory];
for(DWORD i=0; i<width_of_memory; ++i)
[INDENT]memory[i]=new DWORD[height_of_memory];[/INDENT]

or use vector<vector<DWORD>>, then push_back(vector<DWORD>) on your first vector, and push_back(DWORD) on each vector within that one. Benefit here is that each stack (lined up along the width of your memory) can have a different height.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.