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
🌐
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 ...
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
What does void do in C++
Hi, I’m currently learning both C++ and Unreal Engine from one of the many courses. I am really struggling with the C++ mainly, could anyone explain why you sometimes use void at the beginning of a line of code. Thank you. More on community.gamedev.tv
🌐 community.gamedev.tv
1
0
July 2, 2020
what is void in programming?
Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here. Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today. Start your free trial ... Void basically means ... More on teamtreehouse.com
🌐 teamtreehouse.com
2
January 29, 2015
Meaning of 'void' doesn't return a value
Hi all, I recently came across an answer of the meaning of 'void' on this forum. It was claimed using this doesn't return a value to the main program. Check this programming out; In the main program; read_sensors(); … More on forum.arduino.cc
🌐 forum.arduino.cc
0
February 17, 2022
People also ask

What is void?
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 list, it shows that the function does not take any parameters. Overall, "void" simplifies coding by handling cases where no return value, flexible data types, or parameters are involved.
🌐
lenovo.com
lenovo.com › home
What is Void? A Comprehensive Overview | Lenovo IN
Can I use void pointers in object-oriented programming?
Yes, you can use void pointers in object-oriented programming, especially in languages like C++ where you might deal with low-level memory management. They can be handy when dealing with polymorphism and generic programming.
🌐
lenovo.com
lenovo.com › home
What is Void? A Comprehensive Overview | Lenovo IN
What does it mean when a function has a return type of void?
When a function has a return type of void, it means that the function does not return any value upon completion. Instead of providing a result, the function performs its tasks or operations and then finishes. This is useful for functions designed to execute an action, such as printing a message or modifying data, without sending any information back. Essentially, void indicates that the function’s primary role is to carry out a task rather than provide a result.
🌐
lenovo.com
lenovo.com › home
What is Void? A Comprehensive Overview | Lenovo IN

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
🌐
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 ...
🌐
ThoughtCo
thoughtco.com › definition-of-void-958182
What Is the Definition of "Void" in C and C++?
April 28, 2019 - In computer programming, when void is used as a function return type, it indicates that the function does not return a value. When void appears in a pointer declaration, it specifies that the pointer is universal.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › c language › void-pointer-c-cpp
void Pointer in C - GeeksforGeeks
The below program demonstrates the usage of a void pointer to store the address of an integer variable and the void pointer is typecasted to an integer pointer and then dereferenced to access the value.
Published   3 weeks ago
🌐
Microsoft Learn
learn.microsoft.com › en-us › cpp › cpp › void-cpp
void (C++) | Microsoft Learn
August 5, 2025 - When used for a function's parameter list, void specifies that the function takes no parameters. When used in the declaration of a pointer, void specifies that the pointer is "universal."
🌐
Quora
quora.com › What-is-a-void-in-a-programming-language-Is-void-a-function-in-programming
What is a void in a programming language? Is void a function in programming? - Quora
Answer (1 of 5): Some languages make a big syntactic distinction between subroutines (“callables” that return control to callsite when complete but do not return a value) and functions (“callables” that are like subroutines but also return a value to the callsite in addition to flow controls).
🌐
W3Schools
w3schools.com › java › ref_keyword_void.asp
Java void Keyword
The void keyword specifies that a method should not have a return value. Tip: If you want a method to return a value, you can use a primitive data type (such as int, char, etc.) instead of void, and use the return keyword inside the method:
🌐
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!

🌐
C-programming-simple-steps
c-programming-simple-steps.com › what-is-void.html
What is void in C - C Programming
Master C programming in simple steps! Newbie or advanced you can do this in simple steps! Here are the tutorials and examples that will show you how.
Top answer
1 of 2
3
Void is used when there is no return, for example, You could make a constructor like public String onColorSwitch(String color) { return color; } but if you aren't going to return anything, then you could use, public void onColor() { }
2 of 2
1
Void basically means "no type", "no value" or "empty". Void is most commonly used in functions and methods. If you have worked with functions before, this might help you understand better: java\main.java functions f = new functions(); String message = "Hello world!"; f.print_func(message); java\functions.java public void print_func(String var) { System.out.println(var); } In our main class we make a string with the value "Hello world!" and then call the function print_func with that message as the argument. The function takes the argument and prints it out and returns nothing back to the main class because there is nothing that functions calculated or created -- it just printed a message to the user. This is why we declared our function as a void -- it passes nothing back to it's caller once it's finished running. An example where void shouldn't be used: java\main.java functions f = new functions(); int number = 5; int new_number = 0; new_number = f.calc_func(number); System.out.println(new_number); java\functions.java public int calc_func(int var) { int new_number = var * 2; return new_number; } In this example, our function takes a number (in this case the number "5") and calculates it's double (5 x 2 = 10 in this example). Once the function has completed this calculation, our main class needs to know what was calculated, so the function needs to return this value back to it's caller. The main class get's the value and stores it in new_number which is then printed out to the user. So whenever you create a function or method in java, you need to tell java the type that is being returned (int, String, etc). If nothing is returned, then you need to tell this by using void where applicable. Void can also be used as a pointer for unknown types, but that's a bit advanced. Hope this helps! :)
🌐
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.
🌐
Rebus Community
press.rebus.community › programmingfundamentals › chapter › void-data-type
Void Data Type – Programming Fundamentals
December 15, 2018 - The void data type, similar to the Nothing data type described earlier, is the data type for the result of a function that returns normally, but does not provide a result value to its caller.[1]
🌐
DataCamp
datacamp.com › doc › java › void
void Keyword in Java: Usage & Examples
The void keyword in Java is used to specify that a method does not return any value. It is a return type that indicates the method performs an action but does not produce a result that can be used elsewhere in the code. The void keyword is typically used in method declarations.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › csharp › language-reference › builtin-types › void
void - C# reference | Microsoft Learn
March 30, 2024 - Access to this page requires authorization. You can try changing directories. ... You use void as the return type of a method (or a local function) to specify that the method doesn't return a value.
🌐
Arduino Forum
forum.arduino.cc › projects › programming
Meaning of 'void' doesn't return a value - Programming - Arduino Forum
February 17, 2022 - Hi all, I recently came across an answer of the meaning of 'void' on this forum. It was claimed using this doesn't return a value to the main program. Check this programming out; In the main program; read_sensors(); Serial.println(t); out of the main program; void read_sensors(){ The void part reads a temperature.
🌐
GeeksforGeeks
geeksforgeeks.org › computer science fundamentals › void-pointer-in-programming
Void Pointer in Programming - GeeksforGeeks
July 23, 2025 - Void Pointer is an important concept of both C and C++. Void pointers are a powerful tool in programming that can provide flexibility and code reusability.
🌐
Unity
discussions.unity.com › questions & answers
What does "void" mean when in front of... - Questions & Answers - Unity Discussions
June 15, 2011 - What does “void” mean when in front of “Update ()” or “Start ()” In doing some online C# searches, I see the following: VOID = Keyword used to indicate that a method does not return a value. But I don’t really underst…