There is number of methods to allocate an array of intrinsic type and all of these method are correct, though which one to choose, depends...
Manual initialisation of all elements in loop
int* p = new int[10];
for (int i = 0; i < 10; i++)
{
p[i] = 0;
}
Using std::memset
function from <cstring>
int* p = new int[10];
std::memset(p, 0, 10);
Using std::fill_n
algorithm from <algorithm>
int* p = new int[10];
std::fill_n(p, 10, 0);
Using std::vector
container
std::vector<int> v(10); // elements zero'ed
If C++0x available, using initializer list features
int a[] = { 1, 2, 3 }; // 3-element static size array
vector<string> v = { 1, 2, 3 }; // 3-element array but vector is resizeable in runtime