把握命运,追逐梦想

对自己所做的事要有兴趣,同时还要能够坚持不懈

统计

留言簿(1)

阅读排行榜

评论排行榜

关于C的内存分布

#include<stdlib.h>
#include
<memory.h>
#include
<string.h>
#include
<stdio.h>

int func(void)
{
    
static int i = 0;
    
return ++i;
}



int a = 0;
char *p1;
int main()
{

    
int b ;
    
char s[]= "abc";
    
char *p2;
    
char *p3 ="123456";
    
static int c = 0;
    p1 
= (char*)malloc(10);
    p2 
= (char*)malloc(20);

    
int *= &a;
    p 
= &b;
    p 
= &c;

    strcpy(p1,
"123456");

    
int i;
    i 
= func();
    i
= func();

    printf(
"%d\n",i);

    
return 0;
}

//使用VC内存察看来观察

posted on 2009-07-30 09:21 把握命运 阅读(102) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理