8000 Create pointer1.c · mikephp/basic_data_struct@e46092f · GitHub
[go: up one dir, main page]

Skip to content

Commit e46092f

Browse files
committed
Create pointer1.c
1 parent d1a6946 commit e46092f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/array/pointer1.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include "stdio.h"
2+
3+
int main()
4+
{
5+
char *p1,*p2,*p3;
6+
char ch[] = {'a', 'b', 'c'};
7+
char **pp;
8+
p1 = ch;
9+
pp = &ch;
10+
p2 = *pp;
11+
printf("char *p1,*p2,*p3;\nchar ch[] = {'a', 'b', 'c'};\nchar **pp;\np1 = ch;\npp = &ch;\np2 = *pp;\n\n");
12+
printf("p1 %p\np2 %p\npp %p\n ch %p\n&ch %p\n",p1,p2,pp,ch,&ch);
13+
printf("\n&ch[0] %p\n&ch[1] %p\n&ch[2] %p\n",&ch[0],&ch[1],&ch[2]);
14+
if (p1 == p2) {
15+
printf("p1 == p2\n");
16+
} else {
17+
printf("p1 != p2\n");
18+
}
19+
20+
printf("p3 = %p\n", p3);
21+
return 0;
22+
}

0 commit comments

Comments
 (0)
0