0

I don't understand the difference between using a pointer and using a normal variable. I'm learning linked lists in class so the use of pointers seems more straightforward since pointers are used to go to the next node in the list, but I don't understand its more basic uses and I'm feeling stressed as it is something I should already understand but don't.

Konrad Rudolph
  • 506,650
  • 124
  • 909
  • 1,183
gr33kbo1
  • 303
  • 4
  • 5
  • 15
  • 7
    We don't normally use pointers unless we have to. – chris Sep 09 '13 at 16:46
  • 2
    take a look at this, it might help clear your head a bit: http://stackoverflow.com/questions/162941/why-use-pointers – Natan Streppel Sep 09 '13 at 16:48
  • yes but I don't understand what a pointer does that a variable doesn't do – gr33kbo1 Sep 09 '13 at 16:48
  • `closed as not constructive`. I'll never understand this. – Math Sep 09 '13 at 16:49
  • 3
    The question makes no sense. Pointers are ordinary variables, meaning that they can easily be *local* variables. The question contraposes "pointers" and "local variables" as something mutually exclusive. – AnT Sep 09 '13 at 16:51
  • 1
    If you don't understand the difference between a pointer and an `int` variable, for example, then you don't understand pointers yet. I suggest you take some further readings to make it clear. – Natan Streppel Sep 09 '13 at 16:53
  • 1
    We use pointers when we need to point to something. That's what they do. – Mike Seymour Sep 09 '13 at 17:02
  • Ask your teacher for help, sooner rather than later. – GManNickG Sep 09 '13 at 17:10
  • @GManNickG: I think a book will be a better option. I mean person that teaches language, doesn't necessarily use that language. – SigTerm Sep 09 '13 at 18:11

1 Answers1

0

The pointer is in itself just a "normal" variable that just so happens to store a level of indirection to another variable.

Paul Evans
  • 26,798
  • 3
  • 34
  • 52