Top Answer
User Avatar
Wiki User
2009-08-31 07:48:51
2009-08-31 07:48:51

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.


Related Questions

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

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).

#define NULL ((void *)0) /* defined in <stddef.h> */ const char *mynullvar = NULL;

A NULL pointer is a pointer variable that stores the value zero. Although there is a memory address at offset 0, this value is reserved to indicate that the pointer is not pointing at any valid memory. A void pointer is a pointer variable that has no specific type. For instance, int * p; tells the compiler that p will point to a memory location that will be treated as if it were an int type (even if it is a char, or some other type), whereas void * p; tells the compiler that the memory being pointed at has no specific type, and that the type will be determined at runtime by casting the pointer to the appropriate type. This allows the pointer to point to anything, including NULL. An int pointer can also point at anything, but its type is known at runtime and will be treated as such at runtime. The type of a void pointer can only be determined at runtime.

There are times when it is necessary to have a pointer that doesn't point to anything. The macro NULL, defined in , has a value that's guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*.

Answergenerally we use simple pointer, void pointer,null pointer, structure pointer. Answerzero or more (unlimited).

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

A NULL pointer has the same size as a non NULL pointer. NULL means that the pointer has been set to the NULL value that is usually zero (0) but the NULL value is at the digression of the compiler manufacture (and may have a value other than zero) so a pointer should always be set to the NULL value and not zero. Current compilers (32 and 64 bit, Intel chip) have a pointer size of 4 (8 bit) bytes. It should be noted that the number of bits in any data type is at the compiler manufactures digression but is heavily influenced by the computer hardware. void *p= NULL; printf ("%d\n", sizeof (p)); or printf ("%d\n", sizeof (void *));

Pointer is a variable that is used to store the memory address of another variable. There are differenr types of pointers: NULL pointer THIS pointer VOID pointer NEAR pointer HUGE pointer FAR pointer WILD pointer

Answer#ifndef NULL# define NULL ((void*)0)#endifAnswerDon't use pointers that contain NULL-value. Eg:int *myptr= NULL;...*myptr = 32; /* wrong */

... are usable. void pointer (generic pointer) : a special type of pointer which point to some data of no specific types. void *p; null pointer : a special type of pointer which point nowhere. it is usually used to check if a pointer is pointing to a null or free the pointer during deallocation of memory in dynamic memory allocation; it is define by using the predefine constant NULL int *p=NULL; wild pointer : uninitialized pointer. it hold a garbage value. i.e it is not pointing to any memory location yet. dangling pointer: pointer pointing to a destroyed variable. it usually happen during dynamic memory allocation when the object is destroyed but not free and the pointer is still pointing to the destroy object.

void is sort of a "null" type. It can be used to indicate that a function will not return a value or that a pointer has no type applied to it

Void pointer can hold the address of any kind of pointer. But we can't operate on void pointer

The void type has only one purpose: to specify the return type of a function that has no return value. In this case void simply means no type. The only other usage is when used as a pointer to void (void*), which simply means a pointer type that can refer to any type of object. If the pointer is non-null, it must be cast to a specific type before it can be dereferenced.

Using a NULL macro to make C portableI'll assume that you're asking your question for C type language programming. A NULL pointer is a pointer that's guarnteed to point to nothing. This may be 0 in a UNIX/Linux system or some other address in another system. Using the NULL macro to set/initialize your pointers will make your programs more portable among systems than using something like the 0.#include char *c = 0; // initialize to NULL--not portablechar *p = NULL; // initialize to NULL as defined in stdio is portableAddendumThe code:char *c = 0;actually is portable because the compiler converts 0's used in a pointer context (cast to a pointer) to the machine's representation of a NULL pointer, which may or may not be all 0 bits. The NULL macro itself might be defined as something like 0 or (void *)0, and both definitions are portable. As a corollary, the following code is also portable:if (!c) {// do something}because it is equivalent to:if (c != 0) {// do something}and the 0 above is converted to a NULL pointer because it is being compared with a pointer.

There is no difference between public static void and static public void

You cannot "legalize" a null and void marriage. You need to get married "legally".You cannot "legalize" a null and void marriage. You need to get married "legally".You cannot "legalize" a null and void marriage. You need to get married "legally".You cannot "legalize" a null and void marriage. You need to get married "legally".

it is in the future. a different future and the null void is a training camp.

A NULL pointer is any pointer (including a void pointer) that has been initialised but is not currently pointing at anything valid. A void pointer is one that can be assigned any memory address, regardless of the type stored at that memory address. All pointers, including void pointers, must be initialised with a valid memory address before they can be used. An uninitialised pointer will store whatever value happens to reside at its own storage location when it is first instantiated and that value will be interpreted as being a memory address of the type indicated by the pointer. However any attempt to access that memory address would be catastrophic, since it could point literally anywhere, including memory that does not belong to your program. Thus programmers need some way to determine when pointers are pointing at something valid. This is achieved by assigning the NULL value (zero) to pointers that are invalid. In this way, any non-NULL pointer can be regarded as being a valid pointer. The onus is therefore upon the programmer to ensure all pointers are non-NULL prior to any indirect accesses, and to ensure all pointers are nullified when they are no longer required. Void pointers are used when the type being pointed at cannot be determined at compile time. It is up to the programmer to determine the actual type being pointed at runtime, and to cast the pointer accordingly. In most cases, this means utilising runtime type information (RTTI), which naturally incurs a performance overhead. Void pointers are typically used in C. However, in C++, pointers to abstract data types and base classes with virtual interfaces can be utilised instead, thus eliminating any need for RTTI.

Null pointer assignment is a runtime error. It most often occurs when you attempt to assign a value to the NULL address (hence the name of the error) but it can also occur whenever you attempt to assign a value to an address that does not belong to your process. For example: void f (int* p) { *p = 42; // ... } The above function is unsafe because it assumes ptr always refers to a valid address. As a result, the following will cause a null pointer assignment error: f (NULL); // error! Or, more subtly: void g (int* p) { f (p); // p could be valid, but it could also be NULL or even uninitialised! // ... } To avoid null pointer assignments, always initialise your pointers with a valid address. If you have no suitable address to initialise with, initialise with the NULL address: int* ptr = NULL; Every time your code changes the address assigned to a pointer, the onus is upon your code to ensure the validity of that address. If done consistently, any code that assigns through a potentially NULL address can use a simple assertion: void f (int* p) { assert (p != NULL); *p = 42; // ... } In this way you can catch and eliminate null pointer assignments in debug builds (when NDEBUG is not defined) without paying the cost of runtime testing in release builds (when NDEBUG is defined).

Void Pointer is a General purpose pointer ,that does not have any data type associated with it and can store address of any type of variable. Declaration: void * pointer_name;

It does't have size, because it is not an actual type. Void-pointer on the other hand is a generic pointer, sizeof (void *) gives it size.

Example: int *pi; void *pv; pv= (void *)pi; pi= (int *)pv;

Certain clauses of a will made before marriage will be null and void. The wife will be included in the distribution.

A marriage is considered null/void when the previous marriage has not been terminated. An unconsumed marriage also can be considered null/void.

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.