How to define an array of strings of characters in header file?

后端 未结 5 454
眼角桃花
眼角桃花 2021-02-04 04:05

I have many different 3 axis sensors I am writing test code for. In the C files for each of them, I have the same char string defined:

char axis[3][8] = {\"X\",          


        
5条回答
  •  后悔当初
    2021-02-04 04:50

    Put this in your header file

    extern char axis[3][8];
    

    and keep this in a C file:

    char axis[3][8] = {"X", "Y", "Z"};
    

提交回复
热议问题