Home   |   About   |   Terms   |   Contact    
Read & Learn
 

How to find the address of a variable in C++?

C++

☯ All C++ Articles     ☯ All Articles


A new product.




Popular Google Pages:



◕ This article is regarding
How to find the address or the location for ordinary variable in C++?
What is Address Operator in C++?

Last updated on: .



◕ How to find the address or the location for ordinary variable in C++?
What is Address Operator in C++?

To find the address or the location of a variable we just apply the Address Operator.
The Address Operator is represented by &.
We have to use this Address Operator before a variable to get its address or the location in the memory.
For example:
int riyabutu = 2;
cout << riyabutu << endl; // It will show us the value of the riyabutu, which is 2.
cout << &riyabutu << endl; // It will show us the address of riyabutu.
&riyabutu, this will show us the address or the location of the memory where the value of the variable riyabutu is stroed.
Please note: Generally this address comes in hexadecimal form. But this address will be different in different computers.



Related articles:
What is Structure Data Type in C++?
What is the Compound Type in C++?
Array in C++?
Can we read include files in C++?
What is bool Type in C++?
What is char16_t and char32_t in C++?
What is wchar_t in C++?
What is Universal Character Names in C++? How to use Universal Character Names?
What is Escape Sequence in C++? Complete list of Escape Sequence.
Different way to create a new line in C++?




Popular Google Pages:



Top of the page

Amazon & Flipkart Special Products

   


Top of the page