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
4 Answers
+ 5
Welcome to the forum.
Please complete c++ tutorial:
https://www.sololearn.com/learn/CPlusPlus/1643/?ref=app
https://www.sololearn.com/learn/CPlusPlus/1630/?ref=app
+ 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 .
+ 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).
0
Here the sizeof(&a) will return the size of an integer which is 8 in 64 bit machine