基础例子
1 #include <stdio.h>
2 #include <stdlib.h>
3 int main()
4 {
5 char s[1024];
6 char * ss = s;
7 char * who=" I";
8 char * whom = " linux";
9 sprintf(s, "%s love %s\n", who, whom);
10 printf("--------------\n");
11 printf(ss);
12
13 }
------------------------------------------------
1 #include <stdio.h>
2 #include <stdlib.h>
3 int main()
4 {
5 char s[1024];
6 char * ss = s;
7 char * who="I";
8 char * whom = " linux";
9
10 int a[] = {1,2,3};
11 int *aa = a;
12 sprintf(s, "%s love %s\n", who, whom);
13 printf("--------------\n");
14 printf("%c\n",*ss);
15
16 printf("%d,\n",aa[0]);
17 aa++;
18 printf("%d\n",*aa);
19
20 }
result:
--------------
I
1,
2
------------------------------------------