Re:Massacring C Pointers (2018)
by grayhatter on Saturday September 05, 2020 @06:36PM
(#24387401)
Nah, that's wrong. A variable doesn't need a type. Case in point; void.
[ Parent
| on HN ]
All variables have types in C. You can't declare a "void" variable. You can declare a void function. Try assigning it to a variable. You can't. void pointers (void*) are a different story.
So just the opposite of what the comment you replied to suggested:
'void' is a type, but in C values of the type void are not first class. Ie a function can return a value of type void, but you can't assign it to a variable.
I'm not sure what you mean, could you explain a bit more?