819 views

2 Answers

Best answer
3 votes
3 votes

Null pointers and void pointers are completely different from each other

To overcome from Wild pointer ( pointer which has not been initialized to anything (not even NULL))use Null pointer. A Null Pointer is a pointer which  is pointing to NULL means nothing. .Null pointer mainly used in Data structure .

A void pointer is known as generic pointer, which can refer to variables of any data type.When a pointer variable is declared using keyword void – it becomes a general purpose pointer variable. Address of any variable of any data type (char, int, float etc.)can be assigned to a void pointer variable.

selected by
1 votes
1 votes
NULL POINTER

suppose u initialise any pointer with any data type then it will create a pointer which will pointing to some memory location may be

in some important part of operating system  where some important instructions or information present , so if there is any changes in

that location may create some big problem in running the system so to protect from these kind of problem there is use of null pointer

which initialise with null address

syntax:

int * a= NULL;

a pointing no where

Related questions

3 votes
3 votes
1 answer
1
Storm_907 asked Apr 16, 2023
465 views
Please explain this question void main() { int a =300; char *ptr = (char*) &a ; ptr++; *ptr=2; printf("%d" , a); }
4 votes
4 votes
4 answers
3
Manoj Kumar Pandey asked May 22, 2019
826 views
https://gateoverflow.in/?qa=blob&qa_blobid=14433986388826671915int main() { int a = 10; int *b = &a; scanf("%d",b); printf("%d",a+50); }What will be the Output of the fol...