CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <vector>
using namespace std;
void* operator new(size_t s)
{
cout << " " << s << " bytes\n";
return malloc(s);
}
int main()
{
cout << sizeof(int) << endl;//4 on sololearn
cout << sizeof(string) << endl;//32 on sololearn
vector<int> vInt(10,0);
cout << sizeof(vInt) << endl;//24 on sololearn
vector<string> vString(10,"");
cout << sizeof(vString) << endl;//24 on sololearn
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run