Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is "void" a scalar type?

On some sites I have found that void is a scalar type:

  • https://ee.hawaii.edu/~tep/EE160/Book/chap5/section2.1.3.html

  • http://herbert.the-little-red-haired-girl.org/en/prgmsc1/docs/part2a.pdf

  • https://www.zentut.com/c-tutorial/c-data-types/

Other sites contain no information about this:

  • https://www.sqa.org.uk/e-learning/LinkedDS01CD/page_03.htm

  • https://i.stack.imgur.com/tFDt3.png

Is void a scalar type or not?

like image 802
Ben Avatar asked Sep 05 '19 13:09

Ben


People also ask

Which are the scalar data type?

The five scalar data types are numeric, character, integer, logical, and complex.

What are scalar types in C++?

Scalar Types Data objects in C++ can be categorized as either scalar (e.g. integers and pointers) or non- scalar (e.g. arrays and classes), where scalars are primitive objects which contain a single value and are not composed of other C++ objects.

What is a scalar object?

Scalar objects are used for singular variables that are not part of a table or an array. If your MIB contains scalar objects, you must run mib2c with a scalar-specific configuration file on the MIB nodes that contain the scalars.


1 Answers

From the C18 standard (6.2.5 §21) :

Arithmetic types and pointer types are collectively called scalar types.

void is neither an arithmetic type, nor a pointer type, so it's not a scalar type.

From 6.2.5 §19 :

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

like image 141
Sander De Dycker Avatar answered Sep 29 '22 20:09

Sander De Dycker