|
-
May 3rd, 2002, 03:05 PM
#1
Thread Starter
Lively Member
Pointers
ok i want to make a function and use a pointer and make it in free store part of the memory like this:
#include <iostream.h>
void hi();
int main ()
{
cout<<"hi"<<endl;
hi();
cout<<pAge<<endl;
/* it doesnt remember pAge when it should be in the free store part of memory which means it should stay in memory right ? */
}
void hi()
{
int * pAge = new short int;
*pAge = 6;
}
why is pAge deleted from memory when i put it in free store where it shouldnt be deleted ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|