1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

cheking whether memory has allocated dynamically or not ?

Discussion in 'C' started by karthik.v, Oct 18, 2010.

  1. karthik.v

    karthik.v New Member

    Joined:
    Oct 18, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    hi...

    please tell me how to check whether memory has allocated dynamically or not ?


    any help is greatly appreciated.

    thanks in advance :)
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    If malloc returns NULL, then it didn't allocate anything.
     
  3. zaster

    zaster New Member

    Joined:
    Oct 9, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    If you are using C++, new throws bad_alloc exception if memory is not allocated.
     

Share This Page