发布时间:2018-12-12 16:19:31
#include <stdio.h>struct Test {int len;char data[0];};int main(){char str[] = "abc";Test* t = (Test*)malloc(sizeof(struct Test) + sizeof(str));t->len = sizeof(str);memcpy(t->data, str, sizeof(str));printf("len: %d\n", t->len);printf("data: %s\n", t->data);free(t);}.........【阅读全文】
发布时间:2013-08-01 09:17:38
进程中内存空间的划分:1. 代码区 – 存放代码/函数,只读区2. 全局区 – 保存全局变量,读写区3. BSS段 – 未初始化的全局变量,BSS段在main执行前会自动清04. &.........【阅读全文】