2015年2月5日 星期四

Different between const int * , int const * and int * const

* Question: 
What different between const int * , int const * , int * const ?

* Answer: 
  • int*                                                           - pointer to int
  • const int * == int const *                     - pointer to const int
  • int * const - const pointer to int
  • const int * const == int const * const - const pointer to const int

  • int **                       - pointer to pointer to int
  • int ** const             - a const pointer to a pointer to an int
  • int * const *           - a pointer to a const pointer to an int
  • int const **            - a pointer to a pointer to a const int
  • int * const * const - a const pointer to a const pointer to an int


* Reference: 

http://stackoverflow.com/questions/1143262/what-is-the-difference-between-const-int-const-int-const-int-const

沒有留言:

張貼留言