const关键字

1》修饰基本类型变量(使其只读)

2》修饰指针:

  ①、int const *p或者const int *p;

    *p是只读的,不可以通过指针修改,可以通过变量修改;

  ②、int * const p;

    const将p变为只读数据

  ③、const int * const p;

     const将p和*p都变为只读数据

原文地址:https://www.cnblogs.com/feige1314/p/7226980.html