Pointer– Coding Worksheet
1. Write a C++ program to declare an integer variable,
assign its address to a pointer, display the value,
address, dereferenced value, and modify the value
using only the pointer.
2. Write a C++ program to declare an integer, a float, and
a void pointer, assign both variable addresses to the
void pointer one after the other, display the addresses,
and comment on why dereferencing a void pointer is
illegal.
3. Write a C++ program to declare three integer variables,
store their addresses in an array of pointers, and display
both the addresses and the values using dereferencing.
4. Write a C++ program to declare and initialize an
integer array, use a pointer to traverse and display the
elements using array notation, pointer notation, and
pointer increment (p++).
5. Write a C++ program to demonstrate pointer to pointer
by accessing and modifying a variable value using
single and double dereferencing.
6. Write a C++ program to dynamically allocate memory
for n integers using new, accept and display the values
using pointers, free the memory using delete[]