Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi;
I wonder, What is difference to
C++
int* a;
and
C++
int a;
?

Why use the '*' marker?
Thanks for helps and answer...
Posted
Comments
[no name] 27-Apr-13 18:18pm    
One is an integer variable and the other is a pointer to an integer variable.
Umut Comlekcioglu 28-Apr-13 7:52am    
What did you mean? Which, where used?
Philippe Mori 29-Apr-13 18:52pm    
You should first read a book or a tutorial on C. Without a minimum Learning first, you won't go very far.
Style-7 1-May-13 8:25am    
Go read book.

 
Share this answer
 
v2
Comments
Andreas Gieriet 27-Apr-13 20:13pm    
My 5!
Any tutorial on C would do since this is so basic to C.
Cheers
Andi
The first is like a street sign pointing in one direction, and telling you Moscow is 7843 miles that way.

The second is Moscow. ;-)

P.S.: If you need any more help regarding C/C++ variable declarations, try this link:
http://cdecl.ridiculousfish.com/?q=int%2A+a%3B[^]
 
Share this answer
 
v3
Comments
CPallini 29-Apr-13 3:46am    
Even Napoleon missed that.
:-)
Stefan_Lang 29-Apr-13 4:26am    
He tried to delete Moscow before Allocating it, so he failed due to a Null-pointer exception when trying to dereference it :D
Captain Price 1-May-13 9:35am    
You are russian :D
Pointers are one of the basic features of the C programming language. They should become part of your DNA, like being able to Google for[^].
 
Share this answer
 
Comments
H.Brydon 1-May-13 2:41am    
+5 on all counts!
Sergey Alexandrovich Kryukov 23-Aug-13 23:05pm    
Great, a 5.
—SA
CPallini 24-Aug-13 2:49am    
Thank you, Sergey.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900