天津网站建设兼职大连哪家装修公司最好
天津网站建设兼职,大连哪家装修公司最好,手机电脑网站设计,seo在线网站推广const int *p a;//定义常量指针#xff0c;值不可改
int * const p a;//定义指针常量#xff0c;指向的值可改#xff0c;指向不可改
const为静态常量的意思#xff0c;不可修改。从左到右#xff0c;常量const先出现#xff0c;指针符号*后出…const int *p a;//定义常量指针值不可改
int * const p a;//定义指针常量指向的值可改指向不可改
const为静态常量的意思不可修改。从左到右常量const先出现指针符号*后出现则称为常量指针反之则称为指针常量。 如果是常量const先出现则值不可改
如果是指针符号*先出现则指向不可改
#include iostream
using namespace std;int main()
{int a100; int b10; const int *p a;//定义常量指针值不可改 int * const p a;//定义指针常量指向的值可改指向不可改 cout a endl;cout p endl;cout *q endl;//引用拿内容 system(pause); return 0;}
函数的形参void swapint a,int b和函数的形参是指针voidint *a,int *b的区别。
void swapint *a,int *b在调用的时候直接传入实参即可发送交换打印出来。函数的形参void swapint a,int b需要在函数内部才可打印出来在调用后打印无变化。
即写成void swapint *a,int *b可以方便实参的传递。
#include iostream
using namespace std;void swap(int *a,int *b) { int temp *a;*a*b;*btemp;
}int main()
{int a 10;int b 60;//地址传递 swap(a,b);couta--bendl;system(pause); return 0;
} 结构体是我们自定义的数据类型是存储不同数据的集合体。 #include iostream
using namespace std;//结构体成员数据类型的集合
struct Student
{string name;int age;int score;
};int main()
{//创建结构体变量 struct Student s1;//给结构体成员赋值 s1.namekong;s1.age18;s1.score100; cout s1.names1.ages1.scoreendl;system(pause); return 0;}
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/86563.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!