清霜一梦

sizeof_check

0
阅读(868)

// data:2013 4 1
//designer:pengxiaoen
//function:check the word "sizeof" and the memory

//result :sizeof_p = 4; sizeof_int = 4;
// sizeof_a = 400; sizeof_a100 = 4; sizeof_pa = 4; sizeof_pa0 = 4;
//-------------------------------------------------------------------------------


#include "stdio.h"

int main()
{
int *p =NULL;
int a [100];

int sizeof_p,sizeof_int;
int sizeof_a,sizeof_a100,sizeof_pa,sizeof_pa0;

sizeof_p=sizeof(p);
sizeof_int=sizeof(*p);

sizeof_a = sizeof (a);
sizeof_a100 = sizeof (a[100]);
sizeof_pa = sizeof (&a);
sizeof_pa0 = sizeof (&a[0]);

printf ("sizeof_p = %d\n sizeof_int=%d\n\n",sizeof_p,sizeof_int);
printf ("sizeof_a = %d\n sizeof_a100=%d\n sizeof_pa=%d\n sizeof_pa0=%d\n\n",sizeof_a,sizeof_a100,sizeof_pa,sizeof_pa0);

system("pause");
}


Baidu
map