Basically it means "nothing" or "no type"

There are 3 basic ways that void is used:

  1. Function argument: int myFunc(void) -- the function takes nothing.

  2. Function return value: void myFunc(int) -- the function returns nothing

  3. Generic data pointer: void* data -- 'data' is a pointer to data of unknown type, and cannot be dereferenced

Note: the void in a function argument is optional in C++, so int myFunc() is exactly the same as int myFunc(void), and it is left out completely in C#. It is always required for a return value.

Answer from Gerald on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ data-types-in-c
Data Types in C - GeeksforGeeks
Used in functions that do not return any value. Can also be used for generic pointers (void *) in memory operations.
Published ย  October 18, 2025
Discussions

ELI5: What is the purpose of void in C?
The other comments explain it well but here are some examples. void greet() { printf("Hello, world!\n"); } This is void because it does not return anything, it just does what it is told and doesn't report back. int add(int num1, int num2) { int sum = num1 + num2; return sum; } This has "int" where void would be, because it returns an int value. you would call this somewhere else in the code like so: int total = add(1,2); More on reddit.com
๐ŸŒ r/explainlikeimfive
36
0
March 8, 2024
pointers - Why does void in C mean not void? - Software Engineering Stack Exchange
In strongly-typed languages like Java and C#, void (or Void) as a return type for a method seem to mean: This method doesn't return anything. Nothing. No return. You will not receive anything fro... More on softwareengineering.stackexchange.com
๐ŸŒ softwareengineering.stackexchange.com
August 22, 2014
Please clarify my understanding of the data type 'void'
I have done a lot of research on this, looked at many explanations relating to both Arduino and C++. I've looked at text explanations and video tutorials both. Read over the Arduino.cc reference pages. I've searched this forum and others and read over lots of explanations. More on forum.arduino.cc
๐ŸŒ forum.arduino.cc
0
February 3, 2014
What does void mean in C?
Justine Lam is having issues with: Was doing a google search but couldn't find a good explanation. It seems like it's for declaring a function. More on teamtreehouse.com
๐ŸŒ teamtreehouse.com
1
February 16, 2014
๐ŸŒ
C-programming-simple-steps
c-programming-simple-steps.com
C Programming - Tutorials, Examples, Algorithms
Here you can see what every keyword in C does. Each keyword is described in details. The examples will help you see how each keyword could be used in practice. Note that this is not meant to be a tutorial for the language.
๐ŸŒ
Florida State University
cs.fsu.edu โ€บ ~cop3014p โ€บ lectures โ€บ ch7 โ€บ index.html
Functions 2: Void (NonValue-Returning) Functions
Void functions are created and used just like value-returning functions except they do not return a value after the function executes. In lieu of a data type, void functions use the keyword "void." A void function performs a task, and then control returns back to the caller--but, it does
๐ŸŒ
Reddit
reddit.com โ€บ r/explainlikeimfive โ€บ eli5: what is the purpose of void in c?
r/explainlikeimfive on Reddit: ELI5: What is the purpose of void in C?
March 8, 2024 -

I just began studying C and I cannot, for the life of me, understand void.

I have read and listened to many people say "It does not return a value". Ok? What is a value? Why wouldn't we want to return it? What is the difference between "void main" and "int main"? Can we just use int for everything and ignore void altogether?

In what situations is void used? In what situations is void better? etc. Please help I don't get it at all!

๐ŸŒ
Educative
educative.io โ€บ answers โ€บ what-is-the-void-keyword-in-c
What is the void keyword in C?
The literal meaning of void is empty or blank. In C, void can be used as a data type that represents no data.
Find elsewhere
Top answer
1 of 11
60

The keyword void (not a pointer) means "nothing" in those languages. This is consistent.

As you noted, void* means "pointer to anything" in languages that support raw pointers (C and C++). This is an unfortunate decision because as you mentioned, it does make void mean two different things.

I have not been able to find the historical reason behind reusing void to mean "nothing" and "anything" in different contexts, however C does this in several other places. For example, static has different purposes in different contexts. There is obviously precedent in the C language for reusing keywords this way, regardless of what one may think of the practice.

Java and C# are different enough to make a clean break to correct some of these issues. Java and "safe" C# also do not allow raw pointers and do not need easy C compatibility (Unsafe C# does allow pointers but the vast majority of C# code does not fall into this category). This allows them to change things up a bit without worrying about backwards compatibility. One way of doing this is introducing a class Object at the root of the hierarchy from which all classes inherit, so an Object reference serves the same function of void* without the nastiness of type issues and raw memory management.

2 of 11
32

void and void* are two different things. void in C means exactly the same thing as it does in Java, an absence of a return value. A void* is a pointer with an absence of a type.

All pointers in C need to be able to be dereferenced. If you dereferenced a void*, what type would you expect to get? Remember C pointers don't carry any runtime type information, so the type must be known at compile time.

Given that context, the only thing you can logically do with a dereferenced void* is ignore it, which is exactly the behavior the void type denotes.

๐ŸŒ
Learn C++
learncplusplus.org โ€บ home โ€บ c++ โ€บ what is a void function in the c programming language?
What is A Void Function In The C Programming language?
September 3, 2022 - In C and C++ programing, the void term means โ€œno value is returnedโ€. In math, a function returns a value, i.e. y = f (x); Here f(x) is a function that works with variable x and y is the output of this function.
๐ŸŒ
Rebus Community
press.rebus.community โ€บ programmingfundamentals โ€บ chapter โ€บ void-data-type
Void Data Type โ€“ Programming Fundamentals
December 15, 2018 - The void data type is typically used in the definition and prototyping of functions to indicate that either nothing is being passed in and/or nothing is being returned. ... A data type that has no values or operators and is used to represent ...
๐ŸŒ
Arduino Forum
forum.arduino.cc โ€บ projects โ€บ programming
Please clarify my understanding of the data type 'void' - Programming - Arduino Forum
February 3, 2014 - I have done a lot of research on this, looked at many explanations relating to both Arduino and C++. I've looked at text explanations and video tutorials both. Read over the Arduino.cc reference pages. I've searched thisโ€ฆ
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ void-pointer-c-cpp
void Pointer in C - GeeksforGeeks
For example, compare function which is used in qsort(). void pointers used along with Function pointers of type void (*)(void) point to the functions that take any arguments and return any value.
Published ย  3 weeks ago
๐ŸŒ
ThoughtCo
thoughtco.com โ€บ definition-of-void-958182
What Is the Definition of "Void" in C and C++?
April 28, 2019 - When used in a function's parameter list, void indicates that the function takes no parameters. Void functions, also called nonvalue-returning functions, are used just like value-returning functions except void return types do not return a value ...
๐ŸŒ
Learn C++
learncpp.com โ€บ cpp-tutorial โ€บ void
4.2 โ€” Void โ€“ Learn C++
Basically, void means โ€œno typeโ€! Void is our first example of an incomplete type. An incomplete type is a type that has been declared but not yet defined. The compiler knows about the existence of such types, but does not have enough information to determine how much memory to allocate ...
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_functions.php
C Functions
int main() { printf("Hello World!"); ... executed } myFunction() is the name of the function ยท void means that the function does not have a return value....
๐ŸŒ
Unstop
unstop.com โ€บ home โ€บ blog โ€บ void pointer in c explained in detail with code examples
Void Pointer In C Explained In Detail With Code Examples // Unstop
March 1, 2024 - It is advised to give the pointer a meaningful name that accurately describes its function. A void pointer is a unique type of pointer in the C language that may store the address of any data type.
๐ŸŒ
Lenovo
lenovo.com โ€บ home
What is Void? A Comprehensive Overview | Lenovo IN
In computer programming, "void" serves several purposes. When used as a function return type, it indicates that the function does not return a value. In pointer declarations, "void" means the pointer can point to any data type, making it versatile. When "void" appears in a function's parameter ...
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ Void_type
Void type - Wikipedia
2 weeks ago - The void type, in several programming languages, more so curly bracket programming languages derived from C and ALGOL 68, is the return type of a function that returns normally, but provides no result value to its caller. Usually such functions are called for their side effects, such as performing ...