answersLogoWhite

0


Best Answer

void is type of pointer that usually means that you can make it point to any data type.

When you make a pointer point to somewhere its data type should match with the place where you want it to point.

When you dont know the data type where it will point to then you can declare a void pointer and make it point to the data type it want.

User Avatar

Wiki User

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

Wiki User

13y ago

because void is not return anything every function should have return something void is not return anything so use void

1. pointer: void * is the generic pointer type

2. return value: void means no return value (the default is int)

3. parameter-list: void means no parameters (the default is: unspecified)

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

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

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

In C General purpose pointer is called as a void pointer. It doesn't have any data type associated with it. It can store address of any type of variable.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why do you use a void pointer in a programme?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the use of void pointer?

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;


What is void pointer and what are its uses?

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


What pointer type will you use to implement a heterogeneous linked list in c?

void pointer


Why you are using VOID in C programming?

You don't use 'VOID', but 'void'. It means different things, such as:- void as function type means no return value- void as function parameter means no parameters- 'void *' as pointer-types means generic pointer


Difference between genric pointer and normal pointer?

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


How can void pointer is assigned to an int type pointer?

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


What is generic pointer in C?

When a variable is declared as being a pointer to type void it is known as a generic pointer. Since you cannot have a variable of type void, the pointer will not point to any data and therefore cannot be dereferenced. It is still a pointer though, to use it you just have to cast it to another kind of pointer first. Hence the term Generic pointer.


Is void a data type in c?

what is void data type Void is an empty data type normally used as a return type in C/C++, C#, Java functions/methods to declare that no value will be return by the function. The another use of void is to declare the pointer in C/C++ whe It is not sure that what data type will be addressed by the pointer. eg: void *p; Here p can hold the address of int or float or char or long int or double.


Why void is used in c language?

void as function return-type means no return value void as function parameter means no parameter void * as pointer type means generic pointer


Does having a void double pointer make sense in C?

No, 'void *' and 'double *' are ok; 'void double *' is syntax error.On the other hand 'void **p' is totally correct: p holds the address of a generic pointer.


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;


Application of void data type in c plus plus programming language?

The voiddata type is used when a function doesn't return any value, and/or when it has no parameters at all. Pointer type 'void *' is a generic pointer.A void pointer is used when it needs to be assigned to different data types later on in a program. Since it avoids type checking, void pointers should be used with care.