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
*
&
&&
||
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
33 comments Page 3 of 4.

Lavanya said:   1 decade ago
int a=20,b=30,*p,*q;

p=&a;
q=&b;
p=q;

printf("%d%d",*p,*q);
Output is 30, 30

Ankit Jain said:   1 decade ago
Simply * is called value at the address operator.

Luso said:   1 decade ago
The pointer symbol * means value at address and it retrieves the data stored at that address whether it would be address of some other location or some other values.

Harika said:   1 decade ago
Hi, & defines address in memory, * represents the value of pointer.
(1)

Swapnali said:   1 decade ago
Pointer is used to store the address of the variable of same type. Ex. char *ptr can be used to store address of char ch..

We use & operator to assign the address of variable to pointer Ex. ptr=&ch;

And we use * operator to get value stored at particular address stored in pointer var. Ex. char chh=*ptr;
(1)

Veer pratap singh said:   1 decade ago
Basically pointer variable is called & operator.
(1)

Parag said:   1 decade ago
Hello,

I have executing this code and thus it is perfect.

#include <stdio.h>

void main() {
// your code goes here

int x=10;

int *y;
y=&x;
printf("value at Y is %d\n",y);
printf("value at *Y is %d\n",*y);
printf("value at &Y is %d\n",&y);
}

Value at Y is -1076357592.
Value at *Y is 10.
Value at &Y is -1076357588.
--------------------------------------------------------------

So to conclude:

y gives address of x.
*y gives data of x.
&y gives the address of y. The memory which contains the address of x.
(1)

Manmeet said:   1 decade ago
If we want to fetch the address of a variable we use & and on the other hand if we want to fetch the value from the address we use *.
(2)

Ravi ku said:   1 decade ago
#include<stdio.h>
#include<conio.h>
void main()
{
int a=10;
int *p;
p=&a;
printf("value of A %d",a); //Output-10.
printf("value of A %d",*P); //Output-10.
printf("Address of A %p",a); //Output-fff2.
printf("value of p %d",p); //Output-fff2.
printf("Address of p %d",p); //Output-fff4.
(2)

Shraddha said:   10 years ago
I think & is used for address.
(3)


Post your comments here:

Your comments will be displayed after verification.