What is "void" type in C/C++ ? | C Programming and Computer Geeks

Search MY Blog

Monday 23 December 2013

What is "void" type in C/C++ ?


Before going to the void data type, First let us understand the data type concept.
In C/C++ programming language, the data types refer to an extensive system used for declaring/defining variables/objects or functions of different types. The type of a variable determines how much memory space it occupies in storage and how the bit pattern stored is interpreted.
char, int, float, double, void etc.. are some of the data types in C language.
Data types in C/C++
Data Types in C/C++

Now coming to the void data type..
void is basically a keyword to use as a placeholder where you would put a data type, to represent "no data".
void actually refers to an object that does not have a value of any type.

When "void" type is used in function definition it means that function will not return any value.

When "void" is used with pointer type variable declaration eg: void* a or void* b etc. It means any empty type i.e. later in the program you can point any data type(int or float type variable) to a or b respectively.


Click here for more C Tutorials and Concepts.

Search This Blog