Simple C array declaration / assignment question

后端 未结 9 1889
醉话见心
醉话见心 2021-01-05 06:13

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

9条回答
  •  逝去的感伤
    2021-01-05 06:41

    you can declare static array with data to initialize from:

    static int initvalues[3] = {1,2,3};
    …
    if(1)
        memmove(values,initvalues,sizeof(values));
    

提交回复
热议问题