==> EXTREME BEGINNER QUESTION FOR EXTREME BEGINNERS <==
Does anyone know why this: void buf[1];
returns this error:
error: array has incomplete element type 'void'
.
Is it normal ?
==> EXTREME BEGINNER QUESTION FOR EXTREME BEGINNERS <==
Does anyone know why this: void buf[1];
returns this error:
error: array has incomplete element type 'void'
.
Is it normal ?
You can't declare an array of void types - perhaps you meant to declare an array of void pointers? In this case you would do
void *buf[1];
However, it seems more likely you just want one void pointer?
void *buf;
void
is not a complete type. It is only used either in a function definition to state that it either takes no parameters or returns no value, or as a generic pointer i.e. void *ptr
.
As such, a variable of type void
cannot exist.