As title
#include <iostream>
int main() {
auto* a = new float[1000000];
auto* b = new float[10]();
for(auto i=0; i<1000000; i++){
std::cout << "a" << a[i] << std::endl;
}
for(auto i=0; i<10; i++){
std::cout << "b" << b[i] << std::endl;
}
return 0;
}
what's the difference? I had tried both output is zero.
In addition what's about smart pointer, how to make sure it can zero initialized.
std::unique_ptr<int[]> p = std::make_unique<int[]>(100);
Aucun commentaire:
Enregistrer un commentaire