#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int* a = (int *)malloc(10);
std::cout << sizeof(a) << endl;
std::cout << sizeof((int *)malloc(10)) << endl;
std::cout << sizeof((double *)malloc(10)) << endl;
std::cout << sizeof((char *)malloc(10)) << endl;
string s = "";
string ss = "Hello";
char* css = "Hello";
char ccss[] = "Hello";
string sss = "Hlo";
cout << sizeof (string) << endl;
cout << sizeof (s) << endl;
cout << sizeof (ss) << endl;
cout << sizeof (css) << endl;
cout << sizeof (ccss) << endl;
cout << sizeof (sss) << endl;
cout << sizeof (new string()) << endl;
cout << sizeof ("Hello") << endl;
cout << sizeof ("He") << endl;
cout << sizeof ("H") << endl;
int a = 0;
cout<<sizeof(a=3)<<endl;
cout<<a<<endl;
return 0;
}
malloc,alloc,realloc之间的相似与区别