Define Array in C

前端 未结 3 2002
盖世英雄少女心
盖世英雄少女心 2021-01-02 03:53

I have several 450 element character arrays (storing bitmap data to display on lcd screens.) I would like to put them under a header file and #define them, but

3条回答
  •  悲哀的现实
    2021-01-02 04:23

    Well... you certainly don't need to use a define. Just add them into the header as const, static arrays.

    /* prevents multiple, redundant includes */
    /* make sure to use a symbol that is fairly sure to be unique */
    #ifndef TEST_H
    #define TEST_H
    
    /* your image data */
    const char image[] = { 1, 2, 3, 4, ... };
    
    #endif
    

    Also, if you want help on a compilation error then you should post your code.

提交回复
热议问题