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

mvmalderen commented: You're double-posting !! (Double-post: http://www.daniweb.com/forums/thread181329.html) +0

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

try

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.