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

后端 未结 5 448
眼角桃花
眼角桃花 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 05:03

    Add this to your header:

    extern char *axis[];
    

    Add this to one source file in your project:

    char *axis[] = { "X", "Y", "Z", "Time", "Space", "The Scary Door" };
    

提交回复
热议问题