3 ms·
> In C the Any type is void. Using the class definitions above this is entirely valid and produces no warnings: > void v; > struct t1 = v; I assume you mean a
by prattmic 12y ago
> In C the Any type is void. Using the class definitions above this is entirely valid and produces no warnings:
> void v;
> struct t1 = v;
I assume you mean a pointer to void here. You explicitly cannot have a void value, as void is an incomplete type (it has no size).
$ gcc -x c - <<<"int main(void) {void a; return 0;}"
<stdin>: In function ‘main’:
<stdin>:1:22: error: variable or field ‘a’ declared void
You can have a pointer to void, which works as you describe, though you must also use a pointer to the struct.
void *v;
struct t1 *b = v;