blob: 1efc25e36d8abce85b2f5ebfe7f47b7eac19182f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#include <stdio.h>
void
test1(void)
{
char *sp;
char s[] = "str";
sp = s;
printf("sp: %s\n", sp);
printf("s: %s\n", s);
int a = 513;
int *ap = &a;
int **app = ≈
printf("a: %d\n", a);
printf("ap: %d\n", *ap);
printf("app: %d\n", **app);
}
void
test2()
{
char *str = "abc";
printf("for:\n");
for (unsigned int i = 0; i < 3; i += 1)
{
printf("%c\n", str[i]);
}
printf("---\nwhile:\n");
while(*str) {
printf("%c\n", *str++);
}
}
int main(void)
{
test1();
test2();
return 0;
}
|