struct node
{
bool is_b;
node* next;
node *one=new node(); node *one = new node;
-->new node() zero initializes the data,is_b will be false, and all of the pointers will be NULL.
-->new node doesn't
{
bool is_b;
node* next;
};
What's the difference betweennode *one=new node(); node *one = new node;
-->new node() zero initializes the data,is_b will be false, and all of the pointers will be NULL.
-->new node doesn't
For allocating arrays? there anything equivalent ?
int* arry_i = new int[10]; ->allocates uninitialized ints
int* arry_i = new int[10]();->allocates ints initialized to 0 on (recent) compilers
allocates ints initialized to 0 on all compilers
std::vector
No comments :
Post a Comment