const指针 常指针
生活随笔
收集整理的這篇文章主要介紹了
const指针 常指针
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
(2)常指針
必須進(jìn)行初始化,且const指針的值不能修改。
#include<iostream> using namespace std; int main(){const int num=100;const int *ptr=# //error! const int* -> int*cout<<*ptr<<endl; }總結(jié)
以上是生活随笔為你收集整理的const指针 常指针的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c++ const 常指针
- 下一篇: c++ 静态变量