0

What does '&a' do in sizeof(&a)??

int a; a=100 cout<<"\nExplain Variable of a"<<sizeof(&a); https://www.sololearn.com/discuss/2529440/?ref=app

6th Oct 2020, 12:20 AM
Basim Ahmad
4 Answers
6th Oct 2020, 12:49 AM
Kevin ★
+ 3
&a means reference to a. sizeof(&a) will return the size of the reference/(address) of a. which is in general 8 bytes in 64bit architecture and 4 bytes in 32bit arch .
6th Oct 2020, 12:50 AM
Bahha┣
Bahha┣ - avatar
+ 1
Hey Address in C is represented as &a, read as address of a.& is written before any variable because it shows the address of variable where the value will save or what is the address of a .For a 32bit computer, the pointer size can be 4 bytes; 64bit computers can have 8 bytes .It doesn't depend on the data type it points to. Typically size of pointer in C is equal to word size of machine. All types of pointers (void*, int*, char*, long* etc) will have same size (except function pointers).
6th Oct 2020, 3:54 AM
AjayGohil
0
Here the sizeof(&a) will return the size of an integer which is 8 in 64 bit machine
6th Oct 2020, 7:10 AM
Aditya rout
Aditya rout - avatar