cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Create Pointer question
Create Pointer question
Nov 26, 2010 at 1:24pm UTC
fukki
(43)
Hello,
1]
what is the difference of
int* a; and int *a; ?
also
2]
int *p;
p=new int;
is the same as
int *p=new int;
?
Nov 26, 2010 at 1:59pm UTC
beginning
(31)
the same
Nov 26, 2010 at 2:05pm UTC
filipe
(1165)
1) There's no difference. It's a matter of style. I prefer
int
* a;
because a's type is pointer to int (int*). Notice if you say
int
* a, b;
, b will not be a pointer, but an int. But you shouldn't declare these on the same line anyway.
Nov 26, 2010 at 2:20pm UTC
fukki
(43)
Nice, i will keep them in different lines.
Thanks beginning and filipe!
Topic archived. No new replies allowed.