In C the fread() has a parameter of a void* which will be assigned the value of the next chunk of bytes being read from the file. My understanding is that a void* is used so that several data types can be given to the function. However when I try to use this type of parameter in my own function it seems that assigning a value to a void* is not allowed.
For example:
void* ptr = malloc(sizeof(int));
int n = 5;
*ptr = n; //Error here
This gives an error saying that void is not assignable. If this is the case then how does it work in the fread()?