memory allocation problem in 2d array

Light Poster
12Mar2008,20:02   #1
rinuvc's Avatar
hi all

am havin a problem with memory allocation of 2d array

can any body help me out ...


it goes like this

char ** a;

in a loop for each time

a[i] = new char(strlen(name)+1);

strcpy(a[i],name);

a[i][strlen(name)+1]='\0';


in a loop i deallocate it with

delete[] a[i];

after the loop

delete [] a;



can any body help me with this ????
thanks in advance...
TechCake
13Mar2008,10:20   #2
asadullah.ansari's Avatar
First this is not right place to query. Just go querry and suggestion and put there your querry.
and other thing is that this thread is duplicate of thread
http://www.go4expert.com/showthread.php?t=9285

The same person post this querry two times.

Please read the rule. Before posting any article or querry, just search that title ap per rule.

Last edited by asadullah.ansari; 13Mar2008 at 10:28..
Go4Expert Founder
13Mar2008,11:41   #3
shabbir's Avatar
Duplicate of memory allocation problem in 2d array. Thread closed.