in programming languages, a keyword indicating the absence of data

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 … Wikipedia
🌐
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 ...
Top answer
1 of 3
106

Void is considered a data type (for organizational purposes), but it is basically a keyword to use as a placeholder where you would put a data type, to represent "no data".

Hence, you can declare a routine which does not return a value as:

void MyRoutine();

But, you cannot declare a variable like this:

void bad_variable;

However, when used as a pointer, then it has a different meaning:

void* vague_pointer;

This declares a pointer, but without specifying which data type it is pointing to.

2 of 3
38

Yes, void is a type. Whether it's a data type depends on how you define that term; the C standard doesn't.

The standard does define the term "object type". In C99 and earlier; void is not an object type; in C11 and later, it is. In all versions of the standard, void is an incomplete type. What changed in C11 is that incomplete types are now a subset of object types. This is just a change in terminology. (The other kind of type is a function type.)

C99 6.2.6 paragraph 19 says:

The void type comprises an empty set of values; it is an incomplete type that cannot be completed.

The C11 standard changes the wording slightly:

The void type comprises an empty set of values; it is an incomplete object type that cannot be completed.

This reflects C11's change in the definition of "object type" to include incomplete types. It doesn't really change anything about the nature of type void.

The void keyword can also be used in some other contexts:

  • As the only parameter type in a function prototype, as in int func(void), it indicates that the function has no parameters. (C++ uses empty parentheses for this, but they mean something else in C (prior to C23).)

  • As the return type of a function, as in void func(int n), it indicates that the function returns no result.

  • void* is a pointer type that doesn't specify what it points to.

In principle, all of these uses refer to the type void, but you can also think of them as just special syntax that happens to use the same keyword.

Discussions

ELI5: Void in C
I think you’ll understand once you learn about functions More on reddit.com
🌐 r/C_Programming
25
3
March 8, 2024
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
void pointers in generic linked list
void * is a pointer type. You shouldn't use it to store integers. More on reddit.com
🌐 r/C_Programming
9
2
November 2, 2020
void()
A return value is the data that the function evaluates to when it completes. If you have a function like this: int multiply(int x, int y) { return x * y; } Then you can write something like this: int result = multiply(6, 7); multiply will run, and the return value will be an int with the value of 42, which will then be assigned to the variable result. When you declare and define a function, you need to specify the return type, because the compiler needs to know how much space to use to store the return value, as well as making sure that you're not assigning the value to a mismatched type, or using it where a function expects a different type. In the case of a void function, you're telling the compiler that your function is not going to return any value at all. void say_hello(char *name) { printf("Hello, %s!\n", name); } In this case you just run the function, and it prints the message and then ends. There's no return value that the function gives you that you can use elsewhere in your program. ie. this would work: say_hello("George"); but this would not: int result = say_hello("George"); More on reddit.com
🌐 r/C_Programming
7
2
June 28, 2023
🌐
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 ...
🌐
Fresh2Refresh
fresh2refresh.com › home › c programming tutorial › c interview questions › what is void in c?
What is void in C? | C Interview Questions | Fresh2Refresh.com
October 15, 2020 - Void is an empty data type that has no value. We use void data type in functions when we don’t want to return any value to the calling function.
🌐
freeCodeCamp
freecodecamp.org › news › data-types-in-c-integer-floating-point-and-void-explained
Data Types in C - Integer, Floating Point, and Void Explained
February 1, 2020 - My value is 1 and my size is 4 bytes. Hello! I am a double floating point variable. My value is 3.140000 and my size is 8 bytes. Bye! See you soon. :) The void type specifies that no value is available.
🌐
TutorialsPoint
tutorialspoint.com › cprogramming › c_data_types.htm
C - Data Types
The void type specifies that no value is available. It is used in three kinds of situations − · An array is a collection of multiple values of same data type stored in consecutive memory locations. The size of array is mentioned in square brackets []. For example, int marks[5]; Arrays can ...
🌐
Quora
quora.com › Is-void-a-data-type
Is 'void' a data type? - Quora
It is a type, but it’s one that generally appears as part of another type—a function type involving [code ]void[/code] or perhaps a pointer ([code ]void*[/code]). This means ...
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › c language › void-pointer-c-cpp
void Pointer in C - GeeksforGeeks
A void pointer is a pointer that has no associated data type with it. A void pointer can hold an address of any type and can be typecasted to any type.
Published   October 11, 2024
🌐
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.
🌐
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
🌐
Quora
quora.com › What-is-void-datatype-in-c
What is void datatype in c? - Quora
Answer (1 of 2): Responding, based on reading your question as > “What is void in C” Every programming language needs a member for referencing objects it uses to execute a piece of logic. And these objects need to be stored in memory During the context of execution.
🌐
Fresh2Refresh
fresh2refresh.com › home › c programming tutorial › c – data types
C data types
September 22, 2020 - To know more about derived data types, please visit “C – Array” , “C – Pointer” , “C – Structure” and “C – Union” topics in this tutorial. Void is an empty data type that has no value.
🌐
GeeksforGeeks
geeksforgeeks.org › c++ › cpp-data-types
Data Types in C++ - GeeksforGeeks
We cannot create a variable of void type. It is used for pointer and functions that do not return any value using the keyword void. C++ is a strongly typed language. It means that all variables' data type should be specified at the declaration, ...
Published   January 15, 2025
🌐
Shiksha
shiksha.com › home › it & software › it & software articles › programming articles › learn data types in c programming with examples
Learn Data Types in C Programming With Examples - Shiksha Online
June 21, 2024 - We use the keyword ‘enum’ to declare new enumeration types in the C programming language. ... A popular example of enumerated data types is the days of the week. ... The void is just an empty data type that depicts that no value is available.
🌐
GeeksforGeeks
geeksforgeeks.org › c language › data-types-in-c
Data Types in C - GeeksforGeeks
C is a statically type language where each variable's type must be specified at the declaration and once specified, it cannot be changed. In this article, we will discuss the basic (primary) data types in C.
Published   October 18, 2025
🌐
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.
🌐
Reddit
reddit.com › r/c_programming › eli5: void in c
r/C_Programming on Reddit: ELI5: 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!

🌐
WsCube Tech
wscubetech.com › resources › c-programming › data-types
Data Types in C Language (With Examples)
August 29, 2025 - Learn about Data Types in C Language with examples. Understand int, float, char, and more for efficient programming. A complete guide for C beginners!