1. sizeof的用法
#include<stdio.h>
#include <malloc.h>
int main()
{
char s[] = "lyj";
char str[100];
char *p = str;
int n = 10;
void *t = malloc( 100 );
printf("%d\n",sizeof (s));
printf("%d\n",sizeof (str));
printf("%d\n",sizeof (p));
printf("%d\n",sizeof (n));
printf("%d\n",sizeof (t));
return 0;
}
输出结果为:4, 100, 4, 4, 4。