Void type

The void type, in several programming languages derived from C and Algol68, is the type for the result of a function that returns normally, but does not provide a result value to its caller. Usually such functions are called for their side effects, such as performing some task or writing to their output parameters. The usage of the void type in such context is comparable to procedures in Pascal and syntactic constructs which define subroutines in Visual Basic. It is also similar to the unit type used in functional programming languages and type theory. See Unit type#In programming languages for a comparison.
C and C++ also support the pointer to void type (specified as codice_1), but this is an unrelated notion. Variables of this type are pointers to data of an "unspecified" type, so in this context (but not the others) codice_1 acts roughly like a universal or top type. A program can probably convert a pointer to any type of data (except a function pointer) to a pointer to void and back to the original type without losing information, which makes these pointers useful for polymorphic functions. The C language standard does not guarantee that the different pointer types have the same size or alignment.
In C and C++.
A function with void result type ends either by reaching the end of the function or by executing a return statement with no returned value. The void type may also appear as the sole argument of a function prototype to indicate that the function takes no arguments. Note that despite the name, in all of these situations, the void type serves as a unit type, not as a zero or bottom type (which is sometimes confusingly called the "void type"), even though unlike a real unit type which is a singleton, the void type lacks a way to represent its value and the language does not provide any way to declare an object or represent a value with type codice_3.
In the earliest versions of C, functions with no specific result defaulted to a return type of codice_4 and functions with no arguments simply had empty argument lists. Pointers to untyped data were declared as integers or pointers to codice_5. Some early C compilers had the feature, now seen as an annoyance, of generating a warning on any function call that did not use the function's returned value. Old code sometimes casts such function calls to void to suppress this warning. By the time Bjarne Stroustrup began his work on C++ in 1979–1980, void and void pointers were part of the C language dialect supported by AT&T-derived compilers.
The explicit use of void vs. giving no arguments in a function prototype has different semantics in C and C++, as detailed in the following table:
A C prototype taking no arguments, e.g. codice_6 above, has been deprecated in C99, however.
In Haskell.
Quite contrary to C++, in the functional programming language Haskell the void type denotes the empty type, which has no inhabitants . A function into the void type does not return results, and a side-effectful program with type signature codice_7 does not terminate, or crashes. In particular, there are no total functions into the void type.