通过const 修饰,不让其被随意修改
发布时间:2022-12-21 08:57:53 260
相关标签:
#include
#include
#include
int main()
{
//const 修饰变量,这个变量就称为常变量,不能被修改,但是本质上还是变量
const int num = 10;
const int * p = #//如果放在*的左边,修饰的是*p,表示指针指向的内容,不能通过指针来修改
*p = 20;
printf("%d\n",num);
return 0;
}
文章来源: https://blog.51cto.com/u_13668714/5937241
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报