噢,这只是取其中的一个数组
有好多数组,所以选择条件编译
难道还有其他好办法?

大侠们,还是不行呀,我该怎么办?
#include<stdio.h>
#define ABC_C33
unsigned int *condition(void);
void main()
{
unsigned int *mat;
int n;
unsigned int buf[16];
mat=condition();
for(n=0;n<16;n++) {
buf[n]=* mat++;
printf("0x%02x,",buf[n]);
}
}
unsigned int *condition(void)
{
#ifdef ABC_C33
unsigned int ASC16_C33[16] = {
0x00,0x00,0x18,0x3c,0x3c,0x3c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00
};
return ASC16_C33;
#endif
}
static unsigned int ASC16_C33[16]=
{
0x00,0x00,0
我上面说了,你这样用法很怪
#include<stdio.h>
#define ABC_C33
#define ABC_C34
unsigned int*condition(void);
int main()
{
int n;
#undef ABC_C33
//#undef ABC_C34
#ifdef ABC_C33
static unsigned int buf[16]=
{
0x00,0x00,0x18,0x3c,0x3c,0x3c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00
}
;
#else
static unsigned int buf[16]=
{
0x01,0x01,0x18,0x3c,0x3c,0x3c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00
}
;
#endif
for(n=0;n<16;n++) printf("0x%02x,",buf[n]);
}
#include<stdio.h>
#define ABC_C33
unsigned char *condition(void);
void main()
{
unsigned char *mat;
int n;
char buf[16];
mat=condition();
for(n=0;n<16;n++) {
buf2[n]=* mat++;
printf("0x%02x,",buf[n]);
}
}
unsigned char *condition(void)
{
#ifdef ABC_C33
static unsigned char ABC_33[16] = {
0x00,0x00,0x18,0x3c,0x3c,0x3c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00
};
return ABC_33;
#endif
}
这样应该就可以了~~