In C, all object pointers are implicitly convertible to and from void pointers, so you can easily call your function with (&x, sizeof x)
for any object x
.
It's true that you would use some kind of char
pointer to address memory as an array of bytes, but if your function took a char *
, you would need an explicit cast at the call site.