Monday, May 5, 2014

Class of May 5, 2014

Happy Cinco de Mayo!!

          In today's class, we discussed pointers, the new operator, and the delete operator. Pointers tell us where a variable is located. It is really simple to understand.

To declare pointers:
ex: double *p;

The address of operator:
ex: p1 = &v1

The new operator creates a pointer to a new "nameless" variable of type int.
ex: p1 = new int

The delete operator immediately releases the memory space that will no longer be used by the program. This is a great tool since it prevents a program from taking all the memory.
ex: delete p;


No comments:

Post a Comment