Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
Hi;
I wonder, What is difference to
int* a;
and
int a;
?
 
Why use the '*' marker?
Thanks for helps and answer...
Posted 27-Apr-13 13:14pm
Comments
ThePhantomUpvoter at 27-Apr-13 18:18pm
   
One is an integer variable and the other is a pointer to an integer variable.
tazugur at 28-Apr-13 7:52am
   
What did you mean? Which, where used?
Philippe Mori at 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 at 1-May-13 8:25am
   
Go read book.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
v2
Comments
Andreas Gieriet at 27-Apr-13 20:13pm
   
My 5!
Any tutorial on C would do since this is so basic to C.
Cheers
Andi
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

The first is like a street sign pointing in one direction, and telling you Moscow is 7843 miles that way.
 
The second is Moscow. Wink | ;-)
 
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[^]
  Permalink  
v3
Comments
CPallini at 29-Apr-13 3:46am
   
Even Napoleon missed that.
:-)
Stefan_Lang at 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
Pravinda Ama. at 1-May-13 9:35am
   
You are russian :D
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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[^].
  Permalink  
Comments
H.Brydon at 1-May-13 2:41am
   
+5 on all counts!
Sergey Alexandrovich Kryukov at 23-Aug-13 23:05pm
   
Great, a 5.
—SA
CPallini at 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)

  Print Answers RSS
0 OriginalGriff 341
1 Marcin Kozub 225
2 Praneet Nadkar 197
3 Sergey Alexandrovich Kryukov 190
4 Shweta N Mishra 161
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 1 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100