Int *a=new int b; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Int *a=new int b;

What does it indicate explain in a easy way

28th Dec 2018, 9:37 AM
Jonny Walker
Jonny Walker - avatar
3 Answers
+ 7
Int *a=new int b; What does it indicate? It means you are trying to learn c++ and thus you are getting finest beating like everyone lol
28th Dec 2018, 12:11 PM
AZTECCO
AZTECCO - avatar
+ 6
int *a = new int b; Is a syntax error as: expected ',' or ';' before 'b' int *a = new int, b; Allocate memory for a single integer dynamically on the heap and returns its address to pointer `a`. Then declare another integer variable. int *a = new int[b]; Allocate memory for an array of integers of size `b` on the heap and returns the base address to pointer `a`.
28th Dec 2018, 9:46 AM
Babak
Babak - avatar
+ 4
AZTECCO I'm hungry! Loool
28th Dec 2018, 12:33 PM
Babak
Babak - avatar