Loading, please wait...

The Void Data Type

The void is an empty Data Type that has no values. These are used for functions and pointers.

 

S.No.

Types

Description

1.

Function return as void

There are various functions in C which do not return any value or you can say they return void. A function with no return value has the return type as void. For example, void exit (int salary);

2.

Function argument as void

There are various functions in C which do not accept any parameter. A function with no parameter can accept a void. For  example, int rand(void);

3.

Pointers to void

A pointer of type void * represents the address of an object, but not its type. For example, a memory allocation function void *malloc(size_t size); returns a pointer to void which can be cast to any data type.