Computer Programming
C Programming
The Difference Between

What is the difference between a pointer and de-reference pointer?

567

Top Answer
User Avatar
Wiki User
Answered
2011-11-09 23:02:09
2011-11-09 23:02:09

A pointer is an object that contains the address of another object.

A deference'ed pointer is an object. It was a pointer, but its address was used to locate and use that other object as if it was the original target of the instruction.

001
๐ŸŽƒ
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Related Questions


If the element is a pointer, then dereference the element, just as you would dereference any pointer.


difference between pointer or structure


An uninitialised pointer is a pointer that has been instantiated but has not yet been assigned a valid memory address. If you attempt to dereference whatever address happens to exist in the pointer when it was instantiated, then undefined behaviour will result. This is no different to using any other type of variable that has not yet been initialised. A null pointer is a pointer that has been assigned address zero, which simply means "does not point at any address". int *p; // uninitialised pointer -- do not dereference until initialised!! p = 0; // ok -- points at nothing p = malloc (sizeof(int)); // ok -- holds a valid address or zero if the allocation failed Note: if the result of a malloc is address 0, it means the allocation failed, but the pointer is in a valid state. You should always check a pointer is non-null before attempting to dereference the pointer.


The asterisk (*) operator dereferences a pointer and returns the value stored in the memory pointed to by the pointer.


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.


A pointer variable holds the address of a location in memory. But if the pointer hasn't been given a valid address, you can't dereference it. or A pointer that does not point to any data object.



A pointer is a reference to some chunk of memory on your computer. To actually get the value out of said chunk of memory, you must dereference it (i.e. *pointer).


1. pointer to a constant means you can not change what the pointer points to 2. constant pointer means you can not change the pointer.


Pointer holds an address Array holds values


The former is variable, the latter is constant.


A pointer is a variable just like any other, so of course it can be assigned a value. However, being a pointer, the value must be a memory address. If you want to assign a value to that memory address rather than the pointer, you must dereference the pointer.


Generic pointer of type 'void *' is compatible with any (data-)pointer, but you cannot use the following operators on it: + - ++ -- += -= * -> []


There is no similarity between the two.


The difference that i learnt very recently and the one i remember :-)Reference cannot be changed whereas pointer value can be changed.Actually, const pointer = reference.


A void pointer is a pointer that has no type information attached to it.A null pointer is a pointer that points to "nothing". A null pointer can be of any type (void included, of course).


A pointer is a variable. A structure is a type.


If by 'void pointer 0' you mean '(void *)0', then it is equal to NULL.


It means to declare or dereference a pointer to a pointer. For example: int x = 5; int *xPtr = &x; int **xPtrPtr = &xPtr; printf("%d\n", **xPtrPtr);


You do not multiply pointers. If you want to multiply the values that they point to you must dereference them, usually with a *


pointer is use to hold address of another variable whereas array is a collection of elements of similar datatype


--> Array is a collection of same kind of data.--> Pointer is a memory location where the data stored in the memory


Generic pointers are pointers of the type void*. They can point to any object, but you cannot dereference a void* nor can you perform pointer arithmetic because the compiler won't know the runtime type of the object you are actually pointing at. It's up to you to determine the proper runtime type and then cast the pointer to the appropriate pointer type.


A pointer to a function is the memory address that stores the address of a function, while the pointer itself is a function pointer.A pointer to a function might be defined as "int (*pf)(int, int);", while to actually point to the function, you would use a function pointer, such as "pf = &func;".


A Null pointer has the value 0. void pointer is a generic pointer introduced by ANSI. Before ANSI, char pointers are used as generic pointer. Generic pointer can hold the address of any data type. Pointers point to a memory address, and data can be stored at that address.



Copyright ยฉ 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.