What is Address In C Programming?

In this tutorial we learn &(ampersand) means reference in c programming. Mostly it used to receive data by help of scanf() to store a particular address.

Address In C:

If you declare a variable like,

int a;

then “&a” is a address of that variable means address of memory.

Generally, we are using address number of times while declaring “scanf()” used to read the data and store in a particular memory location. Like

scanf("%d", &a);

Here, the above declaration means the value or data entered by user and store in a variable “a”, Let’s take in below Example:

//In C
int main()
  int a=10;
  printf("The address of variable a:%p\n",&a);
  printf("The value of variable a:%d\n",a);
  return 0;

Note: In each time you will get a different address to run the above code.

Lingaraj Senapati

But In C++ case we are using the address(reference) “&” to print:

//In C++
using namespace std;
int main()
    int a=2;
    return 0;

If you find any issue and interested to rewrite it then contact us.

Default image
Lingaraj Senapati
Hey There! I am Lingaraj Senapati, the Co-founder of lingarajtechhub.com My skills are Freelance, Web Developer & Designer, Corporate Trainer, Digital Marketer & Youtuber.
Articles: 216

Newsletter Updates

Enter your email address below to subscribe to our newsletter

Leave a Reply