void means no type. A void* describes a pointer variable that points to no type. That is, it is just an address.
You should be able to assign the address of any type to void* but you shoule get errors assgining the address in a void* to a pointer to a real type unless you typecast.
In any case, you cannot assign the value of an int, float, etc to a void* since those types contain actual values and not addresses.
The above comment applies to C. In C++ you do not use void*. There are templates for that.
More info: I have a function
int ffpky(fitsfile *fptr, int datatype, char *keyname, void *value,
char *comm, int *status);
The data type tells the routine what it's getting: int, float etc.
In the calling program which I'm pretty sure is in c: How do I get an int, float, or string into value.
void means no type. A void* describes a pointer variable that points to no type. That is, it is just an address.
You should be able to assign the address of any type to void* but you shoule get errors assgining the address in a void* to a pointer to a real type unless you typecast.
In any case, you cannot assign the value of an int, float, etc to a void* since those types contain actual values and not addresses.
The above comment applies to C. In C++ you do not use void*. There are templates for that.
Comment