#include <stdio.h>
#include <stdint.h>
#define BAP_FCT_ID_MAX 64
typedef struct
{
uint16_t len;
void *buffer;
}bap_cache_buffer_t;
bap_cache_buffer_t cache_info_table1[BAP_FCT_ID_MAX] =
{
{0,(void *)1},
{0,(void *)2},
{6,(void *)3},
};
bap_cache_buffer_t cache_info_table2[BAP_FCT_ID_MAX] =
{
{0,(void *)4},
{0,(void *)5},
{6,(void *)6},
};
bap_cache_buffer_t cache_info_table3[BAP_FCT_ID_MAX] =
{
{0,(void *)7},
{0,(void *)8},
{6,(void *)9},
};
bap_cache_buffer_t * lcu_cache_info_table[2] =
{
cache_info_table1,
cache_info_table3,
};
typedef bap_cache_buffer_t *lcu_cache_info_table_t[2];
lcu_cache_info_table_t lcu_cache_info_table1 =
{
cache_info_table1,
cache_info_table3,
};
typedef bap_cache_buffer_t (*lcu_cache_info_table1_t)[64];
lcu_cache_info_table1_t p1[2] =
{
(lcu_cache_info_table1_t)cache_info_table1,
(lcu_cache_info_table1_t)cache_info_table3
};
int main()
{
/* 我的第一个 C 程序 */
printf("Hello, World! \n");
printf("cache_info_table_gap:%x\n", cache_info_table2);
printf("%x\n", lcu_cache_info_table[1][1].buffer);
printf("size:%d\n", sizeof(lcu_cache_info_table_t));
printf("%x\n", lcu_cache_info_table1[0][1].buffer);
printf("size:%d\n", sizeof(lcu_cache_info_table1_t));
printf("size:%d\n", sizeof(p1));
printf("a[0]:%x a[1]:%x, cache_info_table1:%x, cache_info_table3:%x\n"
,p1[0], p1[1], cache_info_table1, cache_info_table3);
printf("%x\n", p1[0][0]); //指向 bap_cache_buffer_t buf[BAP_FCT_ID_MAX]的数组首地址
printf("%x\n", p1[0][1]);
printf("%d\n", p1[0][0][0].buffer);
printf("%x\n", p1[1][0]);
printf("%x\n", p1[1][1]);
printf("%d\n", p1[1][0][0].buffer);
return 0;
}
运行结果:
Hello, World!
cache_info_table_gap:404460
8
size:16
2
size:8
size:16
a[0]:404060 a[1]:404860, cache_info_table1:404060, cache_info_table3:404860
404060
404460
1
404860
404c60
7