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. Advertising

  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. Advertising

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:
    396
    coala
    Sep 6, 2006
  2. coala
    Replies:
    1
    Views:
    605
    Victor Bazarov
    Sep 6, 2006
  3. Javier
    Replies:
    2
    Views:
    600
    James Kanze
    Sep 4, 2007
  4. linq936
    Replies:
    2
    Views:
    367
    Richard Bos
    Sep 18, 2007
  5. Disc Magnet
    Replies:
    1
    Views:
    645
    Ian Collins
    May 6, 2010
Loading...

Share This Page