2011年10月8日

C/C++变量在内存中的分布

摘要: C/C++变量在内存中的分布在笔试时经常考到,虽然简单,但也容易忘记,因此在这作个总结,以加深印象。先写一个测试程序:#include <stdio.h>#include <malloc.h>int g_i = 100;int g_j = 200;int g_k, g_h;int main(){ const int MAXN = 100; int *p = (int*)malloc(MAXN * sizeof(int)); static int s_i = 5; static int s_j = 10; static int s_k; static int s_h; i 阅读全文

posted @ 2011-10-08 10:39 MoreWindows 阅读(1924) 评论(1) 推荐(1) 编辑

导航