OiO.lk English C# What is the difference between a , &a and *a?
C#

What is the difference between a , &a and *a?


I am trying to understand the difference between a and &a when a is a pointer.

in the following example code :

int main()
{
    int b = 100;
    int *a;
    a = &b;
    printf("%d %d %d", a , &a , *a);
    return 0;
}

According to my understanding, a is a name given to the address of a. That is :

Therefore I am expecting a and &a to be same when a is a pointer. But in the output, I am getting the first two values ( a and &a ) as different.

Where am I going wrong ?



You need to sign in to view this answers

Exit mobile version