Need help about 'new' operator in C++
This question already has an answer here:
The new
operator allocates memory for the object and then invokes the constructor to initialize it. In file A you do not initialize your objects, thus passing uninitialized pointers to func
, leading to the segmentation fault.
上一篇: 将2D数组传递给C ++函数