#include <iostream>
#include <stdlib.h>
using namespace std;
void Func(char str[100])
{
printf("%d\n", sizeof(str));
}
int main()
{
char str2[200] = {0};
void *p = malloc(100);
Func(str2);
printf("%d\n",sizeof(p));
return 0;
#include <stdlib.h>
using namespace std;
void Func(char str[100])
{
printf("%d\n", sizeof(str));
}
int main()
{
char str2[200] = {0};
void *p = malloc(100);
Func(str2);
printf("%d\n",sizeof(p));
return 0;
}
#include <iostream>
#include <stdlib.h>
using namespace std;
void Func(char *str)
{
printf("%d\n", sizeof(str));
}
int main()
{
char *str2 = NULL;
void *p = malloc(100);
Func(str2);
printf("%d\n",sizeof(p));
return 0;
}
答案是:在32位下都是4字节 ;和大小无关;