C Programming - Pointers - Discussion
Discussion Forum : Pointers - General Questions (Q.No. 8)
8.
The operator used to get value at address stored in a pointer variable is
Discussion:
33 comments Page 3 of 4.
Sanu said:
1 decade ago
For example;
consider int x=10;
int *y;
y=&x;
printf("value at Y is %d\n",y);
output is 10
it is wrong if you r printing *y only get value 10
otherwise it returns address
consider int x=10;
int *y;
y=&x;
printf("value at Y is %d\n",y);
output is 10
it is wrong if you r printing *y only get value 10
otherwise it returns address
Ramprasad said:
1 decade ago
No. Actually
y gives address of x
*y gives data of x
&y gives the address of y. The memory which contains the address of x.
y gives address of x
*y gives data of x
&y gives the address of y. The memory which contains the address of x.
Ramachandran said:
1 decade ago
@Aabir :
int x=20;
int *y=&x;
y=address of x
*y=data of x;
&y == y(same)
int x=20;
int *y=&x;
y=address of x
*y=data of x;
&y == y(same)
Mohammed aabir said:
1 decade ago
What if give int *y;
y=&x;
printf("%d",&y);
y=&x;
printf("%d",&y);
Deepak said:
1 decade ago
No apurva is right. Output is 10 if we declare *y.
Satheesh said:
1 decade ago
@Govardhanad is right.
Vinoth said:
1 decade ago
Correct apurva nigam.
Apurva Nigam said:
1 decade ago
@Govardhana Kj :
U r correct but output should be 100(address of x), coz u r printing y not *y . :) :)
printf("value at Y is %d\n",y);
U r correct but output should be 100(address of x), coz u r printing y not *y . :) :)
printf("value at Y is %d\n",y);
Yamuna said:
1 decade ago
By using * (pointer) symbol only we can found the answer.
Also pointer main work is to store the address of another variable.
Also pointer main work is to store the address of another variable.
Dilip said:
1 decade ago
It is a very good platform to learn more programming.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers