Why are pointers so important?

This is a discussion on Why are pointers so important? within the C++ Programming forums, part of the General Programming Boards category; see topic...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    106

    Why are pointers so important?

    see topic

  2. #2
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    Well, pointers have a number of useful applications.

    Firstly, a number of things you do all the time use pointers, even if you are not aware. A struct is a pointer. An array is a pointer. A string is a pointer. A class is a pointer. There is no way of representing a number of associated objects without using pointers in some form or another.

    Also, pointers are useful for efficiency. If you pass ten thousand ints to a function, you will have a substantial time penalty, unless you pass a pointer to an array of ten thousand ints.

  3. #3
    Seņor Member
    Join Date
    Jan 2002
    Posts
    561
    Look into linked lists. Yeah pointers do look pointless at first, but they do have uses.

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    202
    or probaly most important is its the only way to use the "freestore". This will solve your problem of needing a variable in 2 functions but don't want to make it global.
    "Christ died for our sins. Dare we make his martyrdom meaningless by not committing them?"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 05:23 AM
  2. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  3. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 06:58 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21