C语言 指针

C语言一级指针指向一级指针 和二级指针指向一级指针的区别!

 1 #include <stdio.h>
 2 #include <string.h>
 3 
 4 int main(void)
 5 {
 6         char s1[]="hello";
 7         char *p = s1;
 8         char *q = p;
 9         printf("%s
",q);
10 
11         // 一级指针指向一级指针,默认原来指针地址内存放的数据
12         int a = 100;
13         int *s = &a;
14         int *ss = s; // here 没有取地址符号 &
15         printf("%d
",*ss);
16 
17         // 二级指针指向一级指针
18         int b = 10;
19         int *x = &b;
20         int **xx = &x; // here 有取地址符号 &
21         printf("%d
",**xx);
22         return 0;
23 }

结果:

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
原文地址:https://www.cnblogs.com/mmtinfo/p/13755819.html