how to assign an array from an initializer list

前端 未结 3 1465
予麋鹿
予麋鹿 2020-12-30 04:41

I have a limited knowledge about c++. I tried to compile a c++ library and when I run the make file for the following header file

<
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-30 05:34

    when you said:

    boundaries = 
    {{0,512},{0,512},{0.01,5.},{100.,3000.},{0.1,50}};
    

    it was incorrect because c++ does not let you reassign array values. There is an easy work around, but it is somewhat tedious. All you have to do is assign the values one by one. For example:

    boundaries[0][0] = 0;
    boundaries[0][1] = 512;
    boundaries[1][0] = 0;
    boundaries[1][1] = 512;
    

    and so on. I had this same problem in an Arduino program.

    **I am NOT a c++ connoisseur so this is subject to incorrectness.

提交回复
热议问题