Google News
logo
Reference operator (&) In C Language
This referencing operator is also called address operator, which gives the address of a variable, in which location the variable is resided in the memory.

Syntax :  &variable-name;

Example :  int k=10;

Pointers
Printf(“\n The address of k=%u”, &k);
Printf(“\n The value of k=%d”, k);
Output :

The address of k=2020
The value of k=10

Here the expression ‘&k’ gives the address of ‘k’ in which it is stored, the format string %u or %p is used to print address.

Here the expression ‘&k’ is pronounced as “address of k”, the space for ‘k’ at run time may be allocated anywhere in the RAM, and to get the address of ‘k’, reference operator is used.

The address of a variable may not be a fixed location like 2020 above, and is randomly given by the computer.