//greeting.c
1. #include
2. int main()
3. {
4. void my_print(char *string);
5. void my_print2(char *string);
6. char my_string[]="hello there";
7. my_print(my_string);
8. my_print2(my_string);
9. }
10. void my_print(char *string)
11. {
12. printf("The string is %s\n",string);
13. }
14. void my_print2(char *string)
15. {
16. char *string2;
17. int size,i;
18. size=strlen(string);
19. string2=(char *)malloc(size+1);
20. for (i=0;i21. string2[size-i]=string[i];
22. string2[size+1]='\0';
23. printf("The string printed backwand is %s\n",string2);
24. }
阅读(815) | 评论(0) | 转发(0) |