用C数组定义 [英] Define Array in C

查看:174
本文介绍了用C数组定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个元素450字符数组(存储位图数据显示在LCD屏幕上。)我想将它们放在一个头文件和的#define 他们,但我不断收到编译错误。我怎么会在这样做的 C

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 I keep getting compilation errors. How would I do this in C?

的#define号码[450] {0,1,等...}

的#define数字{0,1,等...}

的#define号码[450] 然后再设置编号

还有更多...

推荐答案

呃......你肯定不需要使用定义。只需添加它们到页眉为const,静态数组。

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

另外,如果你想在一个编译错误帮助,然后你应该张贴您的code。

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

这篇关于用C数组定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆