首页 > 其他分享 >指针基本注意点

指针基本注意点

时间:2022-09-19 21:12:10浏览次数:62  
标签:基本 ps puts 注意 printf 字符串 指针 nice

#include "stdio.h"
#include<string.h>
int main(){

	char s[10]="verygood",*ps=s;
	ps+=4;
	printf("%p\n",ps);
	/*这里是 把字符串"nice"的首地址传递给了 ps指针,至于"nice"的存储位置,有编译器分配,不用管
	(反正有它存在的位置),而且这个字符串的值是const是常量,字符串常量,所以在其他函数中调用后不会被销毁。-
	这个是需要注意的点;
	*/
	ps="nice";
	printf("%p\n",ps);

	puts(ps);
	puts(s);
}

标签:基本,ps,puts,注意,printf,字符串,指针,nice
From: https://www.cnblogs.com/develop-up/p/16709080.html

相关文章