background image

{
    //局部静态变量

static int iStaticInt1=0;
static int iStaticInt2=0;

static int iStaticInt3=0;

    
    //局部静态常量定义

const static int iConstStaticInt1=0;
const static int iConstStaticInt2=0;

const static int iConstStaticInt3=0;

    
    //局部常量

const int iConstInt1=1;
const int iConstInt2=5;

const int iConstInt3=6;

    
    //局部变量

int    iLocalInt1=0;
int    iLocalInt2=0;

int    iLocalInt3=0;

char  * pMalloc1,*pMalloc2,*pMalloc3;

    char  * pNew1,*pNew2,*pNew3;

printf("全局常量的内存地址\n");
printf("iGlobalConstInt1=0x%08x\n",&iGlobalConstInt1); 

printf("iGlobalConstInt2=0x%08x\n",&iGlobalConstInt2); 
printf("iGlobalConstInt3=0x%08x\n\n",&iGlobalConstInt3);

printf("iConstStaticInt1=0x%08x\n",&iConstStaticInt1); 

printf("iConstStaticInt2=0x%08x\n",&iConstStaticInt2); 
printf("iConstStaticInt3=0x%08x\n\n",&iConstStaticInt3); 

printf("全局变量的内存地址\n");

printf("iGlobalInt1=0x%08x\n",&iGlobalInt1);
printf("iGlobalInt2=0x%08x\n",&iGlobalInt2); 

printf("iGlobalInt3=0x%08x\n\n",&iGlobalInt3); 

printf("静态变量的内存地址\n");
printf("iGlobalStaticInt1=0x%08x\n",&iGlobalStaticInt1); 

printf("iGlobalStaticInt2=0x%08x\n",&iGlobalStaticInt2); 
printf("iGlobalStaticInt3=0x%08x\n\n",&iGlobalStaticInt3); 

printf("iStaticInt1=0x%08x\n",&iStaticInt1); 
printf("iStaticInt2=0x%08x\n",&iStaticInt2); 

printf("iStaticInt3=0x%08x\n\n",&iStaticInt3); 

printf("本地变量的内存地址\n");
printf("iConstInt1=0x%08x\n",&iConstInt1); 

printf("iConstInt2=0x%08x\n",&iConstInt2); 
printf("iConstInt3=0x%08x\n\n",&iConstInt3);

printf("iLocalInt1=0x%08x\n",&iLocalInt1); 

printf("iLocalInt2=0x%08x\n",&iLocalInt2); 
printf("iLocalInt3=0x%08x\n\n",&iLocalInt3);

funcParamTest(iLocalInt1,iLocalInt2,iLocalInt3);

    //在堆上分配内存,使用 new

pNew1=new char[16];

pNew2=new char[16];