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

后端 未结 5 455
眼角桃花
眼角桃花 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

    Michael Barr (Netrino) advises against the declaration of storage in a header file. Likewise, the Netrino embedded system coding standard does not condone the use of extern'ed storage in headers.

    I generally agree with these principles, and I've found it to be a good idea to extern storage into the C files that need it, and only those.

提交回复
热议问题