Did that make sense…
PaulS already tried, but heck, I’ll take a shot at it too:
He has two functions:
1. A function named segments. The return type of the function is void. (See Footnote.)
2. A function named digits. The return type of the function is void.
The code in his sketch invokes those functions, here and there.
How did I do?
Note to the World: Unless you really like to suffer, I recommend that you snip on the dotted line and discard everything below. Really.
Before we get into a pi$$ing match about what the heck “void” means in C, I’ll note that it is clearly spelled out on the C language standard, ISO/IEC9899:1999(E), in chapter 6.2.5 Types
Except for the stuff in quote marks below, I paraphrase, to make it simpler. (Yes, really.)
In paragraph 1, it says that void is a type that is in the category of incomplete types, where an incomplete type is defined as one of the
types that describe objects but lack information needed to determine their sizes.”
And a little further along, in paragraph 16:
The void type comprises an empty set of values; it is an incomplete type that cannot be completed.”
There is a lot of stuff about what you can’t do with a void type, but the bottom line is that you can’t declare an object of type void, but you can declare a function with a void return type. A void expression is evaluated for its side effects (like calling a function with void return type), but you can’t convert the value of a void expression to something that is not void.
C++ inherits most of the characteristics of C, including the void type, but the language specification writers “enhanced” the narrative a little.
The C++ standard, ISO/IEC 14882:2003(E), has the following in paragraph 9 of Chapter 3.9.1 Fundamental Types:
The void type has an empty set of values. The void type is an incomplete type that cannot be completed. It is used as the return type for functions that do not return a value.”
Now, is that clear enough for everyone? Yeah, I thought so.
I mean, do we really need to go into all of this to answer a question from a Poster who needed to know how to make a for loop but didn’t know there was such a thing? Really? I mean, if reading this kind of stuff gives you a headache, I did recommend that you not read it, right?