answersLogoWhite

0

Is void a data type in c?

Updated: 8/10/2023
User Avatar

Wiki User

12y ago

Best Answer

what is void data type

Void is an empty data type normally used as a return type in C/C++, C#, Java functions/methods to declare that no value will be return by the function.

The another use of void is to declare the pointer in C/C++ whe It is not sure that what data type will be addressed by the pointer.

eg:

void *p;

Here p can hold the address of int or float or char or long int or double.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

Void is not relay a data type as there is no size of storage associated with it where as char, int, long, float etc have a specific size (how many bytes are required to store the variable in).

When it comes to pointers void is the universal pointer.

When void is used as a function argument in a function prototype.

void foo(void)

The first void means that the function does not return a value.

The second void means that there are no function arguments for the function.

This should not be confused with.

void* bar(void *)

Bar returns a pointer of type void and receives an argument of a void pointer.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

as function data type: no value returned (eg: void exit ())

as function parameter: no parameters (eg: getpid (void))

as pointer: generic pointer (void *genptr)

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

void is not a data type, void means empty. We use void when declaring a function:

void getd();

now getd() function will not return any value.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is void a data type in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What use of void data type in c plus plus?

doesn't return the value.


Why void is preemptive data type?

void isn't an actual data-type, preemptive(?) or otherwise.


Application of void data type in c plus plus programming language?

The voiddata type is used when a function doesn't return any value, and/or when it has no parameters at all. Pointer type 'void *' is a generic pointer.A void pointer is used when it needs to be assigned to different data types later on in a program. Since it avoids type checking, void pointers should be used with care.


Empty data types in C?

Void - is empty data type in C


Why do you use a void pointer in a programme?

void is type of pointer that usually means that you can make it point to any data type. When you make a pointer point to somewhere its data type should match with the place where you want it to point. When you dont know the data type where it will point to then you can declare a void pointer and make it point to the data type it want.


What is the size of void data type?

Data-type void has some special features:- it doesn't have values- it doesn't have size- you cannot declare variables with it- void *pointers cannot be dereferenced


What is the use of void pointer?

Void Pointer is a General purpose pointer ,that does not have any data type associated with it and can store address of any type of variable. Declaration: void * pointer_name;


Why void is used in c language?

void as function return-type means no return value void as function parameter means no parameter void * as pointer type means generic pointer


What are the three most common data types used in c?

Pick any three: int, char, long, void, char *, void *


What are the three uses of void data types?

The void type has only one purpose: to specify the return type of a function that has no return value. In this case void simply means no type. The only other usage is when used as a pointer to void (void*), which simply means a pointer type that can refer to any type of object. If the pointer is non-null, it must be cast to a specific type before it can be dereferenced.


What is returntype?

A return type describes the type of data which is returned by a call to a method. They keyword void is used to describe a method which does not return any data.


What are the basic data type and subtype used by C compiler .explain properly?

Basically data types are divided into three types namely, 1. primary data type -> this is sub divide into int, float, char, void. 2. derived data type -> this is sub divide into array, pointer. 3. user defined data type -> this is sub divide into struct, union, enum, typedef. by, k.p.sruthi