首页 > 代码库 > c语言基础

c语言基础

工作多年,C语言基础还是不扎实,惭愧!

 

1、结构体指针嵌套

#include<stdlib.h>#include<stdio.h>#include<stdint.h>int main(){    uint8_t test[8]={1};    struct b_t {        uint8_t *data;    };    struct a_t {        struct b_t *b;    };    struct a_t *a = (struct a_t*)malloc(sizeof(struct a_t));    a->b = (struct b_t*)malloc(sizeof(struct b_t));    a->b->data = http://www.mamicode.com/malloc(8*sizeof(uint8_t));    a->b->data =http://www.mamicode.com/ test;    printf("%d\r\n",*(a->b->data));    return 0;}

 

缺什么补什么...

c语言基础