avatar

Catalog
宏和const的区别

1、编译的时刻不一样
2、

const的简单实用

const作用:1.修饰右边基本变量或者指针变量 int a int *p
2.被const修饰变量只读

int * const p; //p只读,*p可以改

int const * p; //*p只读, p可以改

const int *p; // *p只读,p变量

const int *const p; //都是只读

int const *const p; //都是只读

Author: 木子召
Link: https://lizhaobomb.github.io/2016/11/02/%E5%AE%8F%E5%92%8Cconst%E7%9A%84%E5%8C%BA%E5%88%AB/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Donate
  • 微信
    微信
  • 支付寶
    支付寶

Comment