Click here to Skip to main content
15,912,756 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Dynamic double dimension Pin
Cedric Moonen8-Nov-05 22:32
Cedric Moonen8-Nov-05 22:32 
QuestionRe: Dynamic double dimension Pin
Arrun8-Nov-05 23:06
Arrun8-Nov-05 23:06 
AnswerRe: Dynamic double dimension Pin
kakan8-Nov-05 23:11
professionalkakan8-Nov-05 23:11 
QuestionRe: Dynamic double dimension Pin
Arrun8-Nov-05 23:40
Arrun8-Nov-05 23:40 
AnswerRe: Dynamic double dimension Pin
kakan9-Nov-05 0:07
professionalkakan9-Nov-05 0:07 
QuestionRe: Dynamic double dimension Pin
Arrun9-Nov-05 0:27
Arrun9-Nov-05 0:27 
AnswerRe: Dynamic double dimension Pin
kakan9-Nov-05 0:32
professionalkakan9-Nov-05 0:32 
AnswerRe: Dynamic double dimension Pin
kakan9-Nov-05 2:13
professionalkakan9-Nov-05 2:13 
Hello again. I couldn't let go of your problem. Smile | :)

I found a lot of suggestions at experts exhange, at:
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_21442835.html[^]

This example looks interesting, and complete:
<br />
template < typename T ><br />
T **Allocate2DArray( int nRows, int nCols)<br />
{<br />
    T **ppi;<br />
    T *pool;<br />
    T *curPtr;<br />
    //(step 1) allocate memory for array of elements of column<br />
<br />
    ppi = new T*[nRows];<br />
<br />
    //(step 2) allocate memory for array of elements of each row<br />
    pool = new T [nRows * nCols];<br />
<br />
    // Now point the pointers in the right place<br />
    curPtr = pool;<br />
    for( int i = 0; i < nRows; i++)<br />
    {<br />
        *(ppi + i) = curPtr;<br />
         curPtr += nCols;<br />
    }<br />
    return ppi;<br />
}<br />
<br />
template < typename T ><br />
void Free2DArray(T** Array)<br />
{<br />
    delete [] *Array;<br />
    delete [] Array;<br />
}<br />
<br />
int main()<br />
{<br />
    double **d = Allocate2DArray<double>(10000, 10000);<br />
    d[0][0] = 10.0;<br />
    d[1][1] = 20.0;<br />
    d[9999][9999] = 2345.09;<br />
    Free2DArray(d);<br />
}<br />


In the main function, you can see how to use the array.
I think you should try it out.

Regards
Kakan
AnswerRe: Dynamic double dimension Pin
David Crow9-Nov-05 3:22
David Crow9-Nov-05 3:22 
Question(Urgent) Problem in inserting line numbers in CRichEditView application Pin
sandakith8-Nov-05 21:41
sandakith8-Nov-05 21:41 
AnswerRe: (Urgent) Problem in inserting line numbers in CRichEditView application Pin
James R. Twine9-Nov-05 4:50
James R. Twine9-Nov-05 4:50 
GeneralRe: (Urgent) Problem in inserting line numbers in CRichEditView application Pin
sandakith9-Nov-05 16:12
sandakith9-Nov-05 16:12 
GeneralRe: (Urgent) Problem in inserting line numbers in CRichEditView application Pin
James R. Twine9-Nov-05 16:43
James R. Twine9-Nov-05 16:43 
QuestionProtocol and web-site Pin
includeh108-Nov-05 19:32
includeh108-Nov-05 19:32 
AnswerRe: Protocol and web-site Pin
ThatsAlok8-Nov-05 20:14
ThatsAlok8-Nov-05 20:14 
AnswerRe: Protocol and web-site Pin
S Douglas8-Nov-05 21:41
professionalS Douglas8-Nov-05 21:41 
QuestionHttp connection Pin
includeh108-Nov-05 19:19
includeh108-Nov-05 19:19 
AnswerRe: Http connection Pin
ThatsAlok8-Nov-05 19:55
ThatsAlok8-Nov-05 19:55 
QuestionHiding Toolbars, Menubar, control bar and status bar Pin
romuzu8-Nov-05 17:13
romuzu8-Nov-05 17:13 
AnswerRe: Hiding Toolbars, Menubar, control bar and status bar Pin
douglasjordan8-Nov-05 17:26
douglasjordan8-Nov-05 17:26 
QuestionShift-jis Pin
samkook8-Nov-05 12:04
samkook8-Nov-05 12:04 
Question(Console C++)Resizing mallocation? Pin
Mariano Lopez-Gappa8-Nov-05 10:44
Mariano Lopez-Gappa8-Nov-05 10:44 
AnswerRe: (Console C++)Resizing mallocation? Pin
Ravi Bhavnani8-Nov-05 11:06
professionalRavi Bhavnani8-Nov-05 11:06 
AnswerRe: (Console C++)Resizing mallocation? Pin
Tim Smith8-Nov-05 11:25
Tim Smith8-Nov-05 11:25 
AnswerRe: (Console C++)Resizing mallocation? Pin
douglasjordan8-Nov-05 12:57
douglasjordan8-Nov-05 12:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.