Files
CPlusPlusThings/basic_content/const/funciton_const/condition2/condition1.cpp

10 lines
215 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include <iostream>
using namespace std;
int main() {
int num = 0;
int *const ptr = &num; // const指针必须初始化且const指针的指向不能修改
int *t = &num;
*t = 1;
cout << *ptr << endl;
}