current position:Home>int*p=new int; What do you mean?

int*p=new int; What do you mean?

2022-01-27 00:43:01 CSDN Q & A

This looks like new Create the format of the heap object , however int It's plastic surgery , Can it be used as a class name ? I don't understand the meaning of the expression

Refer to the answer 1:

int *p = new int(N);
This statement is to allocate a section of memory , Initializes a with a value int Type object , Returns its pointer to the defined p. p Referred to int The initial value for the 0.

Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.

Random recommended