memory allocation problem in 2d array

rinuvc's Avatar
Light Poster
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...
0
asadullah.ansari's Avatar, Join Date: Jan 2008
TechCake
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..
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Duplicate of memory allocation problem in 2d array. Thread closed.