memory allocation problem in 2d array

Discussion in 'Meet and Greet' started by rinuvc, Mar 12, 2008.

Thread Status:
Not open for further replies.
  1. rinuvc

    rinuvc New Member

    Joined:
    Mar 12, 2008
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    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 = new char(strlen(name)+1);

    strcpy(a,name);

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


    in a loop i deallocate it with

    delete[] a;

    after the loop

    delete [] a;



    can any body help me with this ????
    thanks in advance...
     
  2. asadullah.ansari

    asadullah.ansari TechCake

    Joined:
    Jan 9, 2008
    Messages:
    356
    Likes Received:
    14
    Trophy Points:
    0
    Occupation:
    Developer
    Location:
    NOIDA
    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: Mar 13, 2008
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice