c++
Destiny罓
这个作者很懒,什么都没留下…
展开
-
C++引用、指针实现交换两个数
#include <iostream> using namespace std; void swap1(int x,int y) { int temp=x; x=y; y=temp; } void swap2(int &x,int &y) { int temp=x; x=y; y=temp; } void swap3(in...原创 2020-04-24 17:47:35 · 1789 阅读 · 0 评论 -
常量指针、指针常量
指针常量(pointer to const指向常量的指针) const double pi=3.14; double *ptr=π //错误:ptr是一个普通指针 const double *cptr=π //正确:cptr可以指向一个双精度常量 常量指针(const pointer) 不变的是指针本身的值而不是指向的那个值 int Num=0; int *const...原创 2020-04-22 18:06:53 · 109 阅读 · 0 评论