In: Computer Science
(a)
What is a pointer?
(b) What is a dereferencing operator?
(c)
What is the difference between assignment statements p1 = p2; and *p1 = *p2;
(d) What is a dynamic variable?
(e)
What is the purpose of the new operator?
(f)
What is the purpose of the delete operator?
(g)
What is the freestore (also called the heap)?
(h)
What is the difference between dynamic variables and automatic variables?
(a) A pointer is an object that stores the memory
address of another object.
(b) Dereference operator is an operator which returns
the value at the address which is pointed by the pointer.
Dereference operator is *.
(c) In p1 = p2, the value of p2 is getting assigned to
p1, in *p1 = *p2, the dereferenced value of p2 is getting assigned
to dereferenced values of p1, the second one deals with pointer
objects.
(d) The dynamic variable is a variable whose address is
determined when the program is run.
(e) The new operator is used to dynamically allocate the memory for
pointer objects.
(f) delete operator is used to free the memory
allocated by the new operator.
(g) freestore is an area of memory that is used for
dynamic allocation of memory while the program is running.
(h) the dynamic variable is the variables which get its
memory by the explicit call, while auto variable gets their memory
assigned by the compiler automatically.