Created
April 9, 2020 18:52
-
-
Save kirugan/bde17059a2e14f03c8ce08ace5919d2e to your computer and use it in GitHub Desktop.
Diff between primitive type initialization using new[ ] operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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