CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Feb 2009
    Posts
    17

    Is it critical to release variable memory in a function?

    Hello,
    suppose we declared and initialized two variable in a function like this:
    Code:
    int function test()
    {
    CString str; int index; str="this is a test"; i=0; //other statements to manipulate these variables return TRUE;
    }
    Now suppose we call this function from main function.Am I must release the memory allocated by str and index variables or they will be released automatically after termination of the function?
    if the application ended, memories that allocated by these 2 variables will release automatically or I have to release them manually?
    Please consider that one of them (str) is a Class and another (index) is a base variable.
    Thanks alot !
    Last edited by soroush_vs; April 13th, 2009 at 03:54 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured