1,567 views

2 Answers

Best answer
3 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 1 vote
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
Position:
Show:

Related questions

8 8 votes
1 1 answer
261
261 views
GO Classes asked Jun 19
261 views
What is the output of the following code?#include <stdio.h void fun(int a[], int *p) { a = a + 5; *(p + 2) = *(p + 2) + 10; p++; *p = *p + 1; } int main() { int arr[] =...
6 6 votes
1 1 answer
209
209 views
GO Classes asked Jun 19
209 views
What is the output of the following code?#include <stdio.h int main() { int arr[] = {10, 20, 30}; int *p = arr; printf("%d %d", *p, *(arr + 2)); return 0; }$\texttt{10 20...
7 7 votes
1 1 answer
219
219 views
GO Classes asked Jun 6
219 views
What is the output of the following code?#include <stdio.h void change(int *p, int *q) { *p = *p + 4; *q = *p + *q; p = q; *p = *p - 3; } int main() { int a = 6, b = 10; ...
7 7 votes
1 1 answer
227
227 views
GO Classes asked Jun 6
227 views
What is the output of the following code?#include <stdio.h int main() { int a = 8, b = 12; int *p = &a; int *q = &b; *p = *p + *q; q = p; *q = *q - 5; printf("%d %d", a, ...