Answer the question
In order to leave comments, you need to log in
What is the difference between declarations (pointers and variables)?
Dear experts!
What happens in memory, and why is it even needed?
int i;
int i*;
int i* = new double;
int i = new double*;
Answer the question
In order to leave comments, you need to log in
1) One variable of type int is created in automatic memory with the name i. The value of i is not defined.
2) Syntax error, perhaps you mean int* i;? In this case, a variable of type int* is created in automatic memory with the name i. The value of i is not defined.
3) Syntax error, perhaps you meant int* i = new int;? In this case, a variable of type int* is created in automatic memory with the name i. Then a variable of type int is created in heap memory, and i is assigned the address of this newly created variable.
4) Syntax error. I have no idea what was meant.
What happens in memory, and why is it even needed?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question