I'm asking: is it possible to perform a multiple assignament values after array definition? I performed different tests with different sintax without success.
Here my source code:
#include <stdio.h>
typedef int coords[3];
int main(int argc, char **argv)
{
coords x = {1, 2, 3}; // it works
x = {1, 2, 3}; // it doesn't work. Compiler gives the 'error: expected expression before ‘{’ token'
// x = (int[3]) {1, 2, 3}; // it doesn't work. Compiler gives the 'error: assignment to expression with array type'
// x = (coords[3]) {1, 2, 3};// it doesn't work. Compiler gives the 'error: assignment to expression with array type'
// x = (coords) {1, 2, 3}; // it doesn't work. Compiler gives the 'error: assignment to expression with array type'
printf("%d\n", x[0]);
return 0;
}
Where I'm wrong ?
Thank you
Marco