相关疑难解决方法(0)

Const正确性 - Const指针作为函数参数

考虑像这样的功能

char* strcpy (char* destination, const char* source);
Run Code Online (Sandbox Code Playgroud)

(地址)源的给定值是const,因为函数的作者想要显示源的值不会被strcpy更改.指针本身不会被strcpy更改为.为什么不写

char* strcpy (char* destination, const char* const source);
Run Code Online (Sandbox Code Playgroud)

提前谢谢了.

c c++

0
推荐指数
1
解决办法
1904
查看次数

标签 统计

c ×1

c++ ×1