Memory allocation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nitinv
    New Member
    • Jul 2007
    • 1

    #1

    Memory allocation

    Hi,
    I would like to know when does memory allocation is done ? during compiletime or during runtime ?
  • Meetee
    Recognized Expert Contributor
    • Dec 2006
    • 928

    #2
    Originally posted by nitinv
    Hi,
    I would like to know when does memory allocation is done ? during compiletime or during runtime ?
    Dynamic memory allocation is done at run time.

    Comment

    • aeo3
      New Member
      • Jul 2007
      • 29

      #3
      you print it as for example
      [code=cpp]
      int* intPtr;
      intPtr=new int;
      if(intPtr==NULL )
      cout<<" Memory allocation fail. \n"
      exit(1);
      }
      [/code]
      if your program can not locate a memory then your program will stop
      Last edited by sicarie; Jul 20 '07, 07:02 PM. Reason: Code tags

      Comment

      Working...