A const pointer question

Discussion in 'C++' started by Tony Johansson, Aug 15, 2005.

  1. Hello Experts!


    I do know what this expression mean const Student stud;
    I do also know what this expression const int* i ;
    But I don't know what this expression mean const Student* stud;

    If you like give some examples.

    Many thanks

    //Tony
     
    Tony Johansson, Aug 15, 2005
    #1
    1. Advertisements

  2. Tony Johansson

    Rolf Magnus Guest

    Tony Johansson wrote:

    > Hello Experts!
    >
    >
    > I do know what this expression mean const Student stud;
    > I do also know what this expression const int* i ;
    > But I don't know what this expression mean const Student* stud;


    It means the same as the one before, with just the type int replaced by
    Student, i.e. it points to an instance of type Student, and that instance
    can't be modified through the pointer. What's unclear about that?
     
    Rolf Magnus, Aug 15, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. coala
    Replies:
    3
    Views:
    572
    coala
    Sep 6, 2006
  2. coala
    Replies:
    1
    Views:
    704
    Victor Bazarov
    Sep 6, 2006
  3. Replies:
    11
    Views:
    1,384
  4. Javier
    Replies:
    2
    Views:
    875
    James Kanze
    Sep 4, 2007
  5. linq936
    Replies:
    2
    Views:
    450
    Richard Bos
    Sep 18, 2007
  6. 0m
    Replies:
    26
    Views:
    1,467
    Tim Rentsch
    Nov 10, 2008
  7. fungus
    Replies:
    13
    Views:
    1,206
    fungus
    Oct 31, 2008
  8. Disc Magnet
    Replies:
    1
    Views:
    818
    Ian Collins
    May 6, 2010
Loading...