answersLogoWhite

0


Best Answer

The dereference operator. In C, we use the * operator for this. Note that the * symbol has several meanings in C (multiplication, pointer declaration and pointer dereferencing). The meaning is determined from the context in which it is used.

int x, y; /* integer variables */

int* p; /* pointer variable (pointer to int) */

x = 42; /* assign a value to the x variable */

p = &x; /* assign the address of the x variable to the pointer variable p */

y = *p; /* assign the value pointed to by p (42) to the variable y */

User Avatar

Wiki User

8y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

Under C, the address of a variable or a function can be obtained by prefixing the name with an ampersand (&), which is called a "reference operator". The address is typically stored in a pointer variable. To access the value in a pointer variable, an asterisk (*) is used, which is called a "dereference operator".

For instance:

void dosomethinguseless()

{

int x=50;

int *y;

y=&x;

printf("%d, %d\n", x, *y);

}

- First, an integer variable called "x" is declared and preloaded with the value "50".

- Next, a variable called "y" is declared as an integer pointer.

- After that, the address of "x" is stored into "y", so that "y" now points to the address where the value of "x" is stored.

- Finally, both variables are printed to demonstrate that they, in one fashion or another, represent the value "50".

See the related link below for more information on C pointers.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

pointer is used to know the address of avariable

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

It is '&' in C

This answer is:
User Avatar

User Avatar

Anonymous

Lvl 1
3y ago

Arrow operator

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which operator is use to find address of a variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

When do we use an address operator in c'?

In C we use & operator while giving address of some variable to some pointer variable. & operator is also used in scanf().


C program to find address of variable?

// Use the & operator (Sometimes called the "address of" operator int variable = 7; printf("Address of variable = %d\n", &variable); printf("Value of variable = %d\n", variable);


In pointers what is the use of pointer variable?

Pointer is a variable that stores the address of another variable . So pointer basically stores the address of another variable and size of pointer can be evaluated by using sizeof operator.


How do you check address of char variable?

Use the address-of operator: char c=32; // space character std::cout<<&c<<std::endl;


What is the purpose of the operator '' when used with a pointer variable?

When a pointer variable stores a non-zero memory address, we can use the dereference operator to access the value stored at that address. This is what we mean by dereferencing and is also known as indirection because we can access a value indirectly through a pointer variable. Note that if the stored address is zero, we must not dereference the pointer as the zero address indicates that the pointer is not currently pointing at any object in particular. The zero address is a reserved address so no object can ever be allocated to it.


What is a use of dereferencing operator?

A pointer variable contains the address to some memory location. "Dereferencing" the pointer means getting the value stored at that memory location.


Which operator is used 2 access ahidden global variables?

To access a hidden global variable, use the scope resolution operator ::


It is required to use an address operator when you accept an input for a string?

No.


What is the purpose of the dereference operator when used with a pointer variable?

Data type is mandatory in every variable-declaration.Example:int i; -- integerint *pi; -- integer-pointerint ai[10]; -- integer-arrayint *api[10]; -- array of integer-pointersint (*api)[10]; -- pointer to integer-array


Which operator is allow to access hidden global variable in c plus plus?

A hidden global variable must be one that has its scope blocked by a local variable of the same name. To access the hidden variable, use the scope resolution operator ::, such as is ::variable_name. If there is another reason for the hidden status, please clarify and restate the question.


What is the use of 'size of' in c programming?

The sizeof operator is used to determine the length of its operand (in bytes). The operand must be a type or an object of a type (a variable). The operator is a constant expression and therefore executes at compile time. As such there is no runtime overhead in repeated use of the sizeof operator.


I have an address in Gothenburg Sweden how do I find out who lives at this address?

If you know their Christian and Surname then phone the long distance operator and ask for 'information.' When you explain the situation most operators will give you the address.