I don't understand what "new int" is supposed to do | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I don't understand what "new int" is supposed to do

28th Jun 2017, 3:22 PM
Prashant
Prashant - avatar
3 Answers
+ 3
int * var = new int; Allocates memory for variable of integer type.
28th Jun 2017, 3:35 PM
Jakub Stasiak
Jakub Stasiak - avatar
+ 4
int is the data type of the variable and new is the keyword to create an object or variable of a fundamental data type
28th Jun 2017, 3:43 PM
⏩▶Clau◀⏪
⏩▶Clau◀⏪ - avatar
+ 2
it obtains memory from the operating system and returns a pointer to its starting point
3rd Jul 2017, 8:20 PM
Francisca Ngeno
Francisca Ngeno - avatar