This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Initialization with new[]
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Initialization with new[]
- From: Alexander Zvyagin <zvyagin at gams dot ihep dot su>
- Date: Thu, 4 Nov 1999 19:27:23 +0300 (MSK)
Dear GCC developers,
Why I can not initialize array of int[] with operator new?
This is example:
#include <iostream>
int main(void)
{
int *a = new int (1); // initialize *a with 1
int *b = new int[2] (1); // initialize each element with 1
cout << *a << " " << b[0] << endl;
}
The output is:
1 0
So b[] is not initialized. Is it correct?
With best wishes,
Alexander Zvyagin.