Theocacao
Leopard
Design Element
Comment on "Intro to C Pointers and Dynamic Memory"
by Steffen Frost — Sep 28
Hi Steven

In your first example you declare a pointer with...

// declare an int variable and an int pointer variable
int number;
int* pointer; <-- no space between 'int' and '*'

In the second example...

// use the asterisk to _declare_ a pointer
int * numberPointer; <-- space between 'int' and '*'

I compiled and ran both with and without the space between 'int' and '*', and it doesn't make a difference. Little things like this can through you off if you are trying to learn syntax.

Just a nit.
Back to "Intro to C Pointers and Dynamic Memory"
Design Element

Copyright © Scott Stevenson 2004-2015