how to access dyn. string-arrays?
Hi,
i have a problem with dynamically allocated strings...
I hope it's ok, if i post this in the C forum though i am using the "new"-keyword (beacuse char* = C-style)
First the code:
Code:
char **mult = new char*[20];
for( int i = 0; i < 20; i++ )
*( mult + i ) = new char[200];
This should allocate 20 strings a 200 bytes.
If i try this, for example-
Code:
*( *( mult + 1 ) + 5) = 'a';
-my program crashes. Strcpy or any other code using this array, crashes, too... How do i access one char or a string from the array not fsckig the program? (please post code)
thanks.