New to C++. Question about constant pointers

前端 未结 10 1893
梦谈多话
梦谈多话 2021-02-10 06:55

I am trying to learn C++ via some web tutorials. I don\'t have a compiler available to me, otherwise I would try this out. I\'m not sure what is meant by a const pointer. Doe

10条回答
  •  伪装坚强ぢ
    2021-02-10 07:33

    You can't learn to drive a car just by reading books.

    Get yourself a C++ compiler if you want to learn C++. g++ is free of charge, as well as Visual Studio 2008 Express Edition.

    As for your question, a const pointer is a zone of memory that is ready only. Example: A class may provide read-only access to an internal buffer.

    Note that you also have the const pointer that is also const, aka

    const char * const p 
    

    In that case, even the value of the pointer cannot be modified.

提交回复
热议问题