Skip to content

Instantly share code, notes, and snippets.

@kirugan
Created April 9, 2020 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirugan/bde17059a2e14f03c8ce08ace5919d2e to your computer and use it in GitHub Desktop.
Save kirugan/bde17059a2e14f03c8ce08ace5919d2e to your computer and use it in GitHub Desktop.
Diff between primitive type initialization using new[ ] operator
int main() {
auto a = new int[1000];
a[500] = 33;
auto b = new(a) int[1000];
std::cout << b[500] << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment