Pointer_Questions_Answers
Pointer_Questions_Answers
1. Define pointer.
datatype *pointer_name;
A pointer is initialized by assigning it the address of a variable using the address operator (&).
Pointers enable dynamic memory allocation and efficient manipulation of arrays and data
structures.
A pointer variable is a variable that holds the memory address of another variable.
The address operator is &, used to obtain the memory address of a variable.
8. What is the pointer operator?
The pointer operator (*) is used to access the value stored at the memory address held by a
pointer.
- Static memory: Memory allocated at compile time, such as global and local variables.
- Dynamic memory: Memory allocated at runtime using operators like new and delete.
The free store is a region of memory used for dynamic memory allocation, managed using new
- Enable the creation of complex data structures like linked lists, trees, and graphs.
An array of pointers is a collection of pointers, where each element stores the address of another
variable.
Example:
5. Define:
b. Static memory allocation: Memory allocation done at compile time, fixed and cannot be resized
during execution.
c. Dynamic memory allocation: Memory allocation done at runtime, allowing flexible memory