answersLogoWhite

0

What is an uninitialized pointer?

Updated: 8/11/2023
User Avatar

Wiki User

12y ago

Best Answer

It means "nothing", there is no data provided at all; just an empty value.

Contrary to the previous edit it does not mean "zero", "none" or "blank"; as zero is a number and none and blank can be regarded as data.

User Avatar

Wiki User

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

Wiki User

12y ago

It means that it doesn't have certain value. It's a mistake when you don't initialize your pointers.Example:uninitialized pointerdouble *p;

initialized pointerdouble *p = 1;

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

For example, if you write NULl instead of NULL.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is an uninitialized pointer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Trying to delete uninitialized pointer to object?

You cannot delete an uninitialized pointer, because there is no allocation for the object, and the pointer contains garbage. That includes the case where you attempted allocation and failed, but deletion is safe in that case because a NULL pointer is "safe" to delete, even though it does not point at anything.


What is the difference between uninitialized pointer and null pointer in c language?

A null pointer is a pointer that has been initialised with the NULL value (zero). An uninitialised pointer is one that has not be initialised to any value and will in fact store whatever value happened to reside in the pointer's own memory address at the point of instantiation. Uninitialised pointers are a clear sign of bad programming because the only safe way to determine if a pointer is valid or not is to compare its value with NULL. An uninitialised pointer will almost always be non-NULL, which means you run the risk of accessing memory that either does not belong to you, or is otherwise invalid. Most compilers include a debug switch to warn you when you attempt to access any uninitialised variable, which naturally includes pointer variables. This switch must be on at all times.Whenever you instantiate a pointer, always initialise it straight away, either by nullifying it, or by storing a valid memory address in it. When you are finished with the pointer, it's good practice to nullify it immediately, even if the pointer would subsequently fall from scope. If the pointer is to be immediately re-assigned, there is no need to nullify it (but it's good practice nonetheless). If you follow this practice at all times, you can be assured that any non-NULL pointer will always be pointing at something valid (and if it isn't, then you have some serious problems elsewhere in your code).As a rule of thumb, if you can use a reference rather than a pointer, use a reference. They are much easier to work with. Pointers should only be used if there's any possibility (however remote) that a reference could be NULL, because a NULL reference will completely invalidate your program (pointers can be NULL, but references can never be NULL). This is why functions such as malloc() and calloc(), and the C++ new operator all return pointers rather than references. You can only return a reference when an allocation is guaranteed to succeed, and a dynamic memory allocation simply cannot make that guarantee.


Different types of pointers in c language?

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


What is triple pointer?

Example: int x; -- integer int *px= &x; -- pointer to integer int **ppx= &px; -- pointer to pointer to integer int ***pppx= &ppx; -- pointer to pointer to pointer to integer


C program pointers to pointers examples?

Pointer to Pointer is a double pointer, denoted by (**). Pointer stores the address of the variable and pointer to pointer stores the address of a pointer variable and syntax can be given as int **ptr2ptr;

Related questions

Trying to delete uninitialized pointer to object?

You cannot delete an uninitialized pointer, because there is no allocation for the object, and the pointer contains garbage. That includes the case where you attempted allocation and failed, but deletion is safe in that case because a NULL pointer is "safe" to delete, even though it does not point at anything.


A c program to show the drawbeck of pointer?

int main (void) { int *p; /* uninitialized pointer */ *p = -1; /* writing to random memory */ return 0; }


What value is stored in uninitialized variables?

Some languages assign a default value as 0 to uninitialized variables. In many languages, however, uninitialized variables hold unpredictable values.


What is a null macro what is the difference between a null pointer and a null macro?

NULL Macro is simply what is defined as 0 in a macro provided by the libraryNull pointer is a pointer which has 0 or NULL value stored and points to nowhwere still it points to 0x00 i.e. the first memory location of the OSNull pointer != Uninitialized pointer because an uninitialised pointer can point anywhere in the memory location ...but a NULL pointer surely points to no where(but still behind the scene we can say that it only points to 0x00). Never we can retrive a Null pointer location using th"&" operator..neither will malloc/calloc return NULL IF THERE IS SPACE IN THE MEMORY. NULL pointer is unique !!nishantnitb@aol.com


What is the difference between uninitialized pointer and null pointer in c language?

A null pointer is a pointer that has been initialised with the NULL value (zero). An uninitialised pointer is one that has not be initialised to any value and will in fact store whatever value happened to reside in the pointer's own memory address at the point of instantiation. Uninitialised pointers are a clear sign of bad programming because the only safe way to determine if a pointer is valid or not is to compare its value with NULL. An uninitialised pointer will almost always be non-NULL, which means you run the risk of accessing memory that either does not belong to you, or is otherwise invalid. Most compilers include a debug switch to warn you when you attempt to access any uninitialised variable, which naturally includes pointer variables. This switch must be on at all times.Whenever you instantiate a pointer, always initialise it straight away, either by nullifying it, or by storing a valid memory address in it. When you are finished with the pointer, it's good practice to nullify it immediately, even if the pointer would subsequently fall from scope. If the pointer is to be immediately re-assigned, there is no need to nullify it (but it's good practice nonetheless). If you follow this practice at all times, you can be assured that any non-NULL pointer will always be pointing at something valid (and if it isn't, then you have some serious problems elsewhere in your code).As a rule of thumb, if you can use a reference rather than a pointer, use a reference. They are much easier to work with. Pointers should only be used if there's any possibility (however remote) that a reference could be NULL, because a NULL reference will completely invalidate your program (pointers can be NULL, but references can never be NULL). This is why functions such as malloc() and calloc(), and the C++ new operator all return pointers rather than references. You can only return a reference when an allocation is guaranteed to succeed, and a dynamic memory allocation simply cannot make that guarantee.


What is null point?

A pointer variable which is declared but not initialized is called a NULL POINTER.ex: int *p;Please don't use the above. A NULL pointer is a specific value assigned to a pointer, just like any other value. NULL is a language-specific designation, and is guaranteed to be comparable to, unlike uninitialized variables, which can have any value.That is:int *a;int *b = NULL;int *c = (int *) malloc(sizeof(char));( a c) is NEVER true.NULL is a reserved word in most high-level languages, and indicates a specific value for assignment. It is commonly used to indicate that something has not yet been assigned a "real" value, or has had its contents deleted. It is an EXPLICIT value, and not just "undefined".In the context of pointers (which, remember, are really memory location addresses), a NULL pointer is one which has NO value, and thus does NOT point to any memory location. The difference between an uninitialized pointer and a NULL pointer is that most common languages do not specify what value an uninitialized pointer has upon creation (many, such as C, are assigned a random value), while a NULL pointer explicitly has NO value (which is the meaning of NULL).Many modern languages and compilers will assign NULL to a pointer upon initialization, but don't count on it. It is sloppy programming to do so, and can lead to many hard-to-find errors.


What did Farmville mean by 'You must purchase the null first'?

This was a programming error in Farmville, which has now apparently been fixed.A "null" programming error refers to a special value used in several languages to represent the thing referred to by an uninitialized pointer/database.


Are Uninitialized variables are a common cause of errors?

Yes they are!


Different types of pointers in c language?

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


What is a NULL Pointer Whether it is same as an uninitialized pointerin C language?

A null pointer is a pointer that holds the value zero (0), which simply means it does not point at anything in particular. It is an error to try and dereference memory address 0x0, as this address is reserved by the system, and will result in undefined behaviour. Pointers must be tested to ensure they hold a non-null address before being dereferenced. An uninitialised pointer is the same as any other uninitialised variable; no value has yet been assigned to it. The value of an uninitialised variable will be whatever value happens to reside in the memory allocated to that variable. All variables, including pointer variables, must be initialised before being accessed for the first time and most compilers will warn against accessing an uninitialised value. Dereferencing an uninitialised pointer has undefined behaviour.


Difference between pointer to constant and constant 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.


What is triple pointer?

Example: int x; -- integer int *px= &x; -- pointer to integer int **ppx= &px; -- pointer to pointer to integer int ***pppx= &ppx; -- pointer to pointer to pointer to integer