Daniel Wood Daniel Wood - 4 years ago 177
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};
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download