0% found this document useful (0 votes)
4 views1 page

C++ Pointer Programming Exercises

Uploaded by

melkameandebet
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

C++ Pointer Programming Exercises

Uploaded by

melkameandebet
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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[]

You might also like