Code Snippets »
C/C++ Code Snippets
C++ - Declare Integer variable dynamically, print the memory addresses
By: Priya Kaushal On 23 DEC 2016
Here, we will learn how we can declare an integer variable dynamically and how to print address of declared memory block?
Consider the following program:
using namespace std;
Here we are declaring an integer pointer ptr and printing the address of ptr by using &ptr along with stored dynamically allocated memory block.
After that we are declaring memory for integer again and printing the same.
From this example - we can understand memory blocks are allocating dynamically, each time different memory blocks are storing in the pointer ptr.
Most viewed pages
- My personal website.
Keywords (like Linux, Java, Oracle etc) used in this website are the trademarks of their respective owners/company. This website is not affiliated to any company. The tutorials are designed by includehelp Team with the help of well known books and other online resources. These Tutorials are free for all, for learning purposes only. Enjoy learning:)
Copyright © 2015 - 2016. All Rights Reserved.