I want to put a literal array into a dynamic memory.
double *rgb = (double*)malloc(3 * sizeof(double));
memcpy(rgb, (double []){1,2,3}, sizeof(rgb));
but I get the error: Too many arguments provided to function-like macro invocation.
But if I do this:
double *rgb = (double*)malloc(3 * sizeof(double));
memcpy(rgb, (double []){1}, sizeof(rgb));
The compiler yields no errors? Why?
Is Objective-c bugged ... or am I missing something?
Your syntax should work with C99, my guess is that you use an older standard.
Before C99 you need to hold the input in a cost variable like this: