I read that void pointers can be casted to implicitly from any pointer, but it seems like they don't work with structs, I made an example:
typedef struct FOO{
int *arr;
size_t size;
} FOO;
int main()
{
void * a;
FOO * b = (FOO*)malloc(sizeof(FOO));
a = b;
b->arr;//works, accessed arr
a->arr;//error: expression must have pointer-to-struct-or-union type
}
I can see that a and b have the same address but I can't use a as if it was of the same type as b, why is that?
Another related question is, can absolutely any pointer be implicitly casted to void *? Even FOO**** to void* for example?