Daniel Wood Daniel Wood - 1 year ago 107
C Question

Simple C array declaration / assignment question

In higher level languages I would be able something similar to this example in C and it would be fine. However, when I compile this C example it complains bitterly. How can I assign new arrays to the array I declared?

int values[3];

values = {1,2,3};

printf("%i", values[0]);


Answer Source

you can declare static array with data to initialize from:

static int initvalues[3] = {1,2,3};