| View previous topic :: View next topic |
| Author |
2. Pointers and Memory |
Cuchulainn

Joined: 18 Dec 2006 Posts: 461 Location: Amsterdam, the Netherlands
|
Posted: Mon Dec 28, 2009 2:37 pm Post subject: |
|
|
int* m;
delete m;
int* n = new int;
delete n;
delete n;
int* p = new int[20];
delete p;
int* q = new int[20];
delete q;
delete [] q;
int* t = new int[20];
delete [] t;
delete t;
{
int* r = new int;
}
int* p1 = p1; |
|
| Back to top |
|
 |
Cuchulainn

Joined: 18 Dec 2006 Posts: 461 Location: Amsterdam, the Netherlands
|
Posted: Wed Jan 28, 2009 10:56 am Post subject: |
|
|
Is the boost scoped_ptr a 'better' auto_ptr?
Is scope_ptr ~ const auto_ptr? |
|
| Back to top |
|
 |
Excel4Net

Joined: 26 Dec 2008 Posts: 8
|
Posted: Wed Jan 28, 2009 2:24 am Post subject: Re: 2. Pointers and Memory |
|
|
What is the auto_ptr? When would you use auto_ptr instead of a pointer?
What is the benefits of using auto_ptr compared tp shared_ptr of the Boost library?
What is the caveats of using auto_ptr? _________________ Excel4Net (www.excel4net.com) - the easy way to get your Excel spreadsheet talking to your .NET code. |
|
| Back to top |
|
 |
Cuchulainn

Joined: 18 Dec 2006 Posts: 461 Location: Amsterdam, the Netherlands
|
Posted: Wed Jan 21, 2009 12:03 pm Post subject: 2. Pointers and Memory |
|
|
What is stack, heap and static memory?
Describe how to create heap-based objects, avoiding the common problems that novices have with raw pointers.
What is
double** mat;
double* mat[10];
double mat[10][20];
How would you initialise the matrix in each case; how do you manage memory?
//
??
pointe vs reference
dereferencing
null pointer
uninitialised pointer |
|
| Back to top |
|
 |
|