values v;
This is an instance of the structure allocated on the stack.
v = malloc(sizeof(values));
malloc returns a pointer void*, and the compiler will not allow you to assign a pointer to an instance.
you need to declare a pointer, and then assign it a malloc return pointer.
sort of
values * v = NULL;
v = malloc(sizeof(values));
source
share