/* * Author: MH * Since 2013/10/21 * Toolkit: Code::Block 12.11 */ #include <stdio.h> void returnString(char **str2) { printf("before: %s\n", *str2); // before: abc *str2 = "def"; printf("after: %s\n", *str2); // before: def } int main() { char *str1 = "abc"; printf("before returnString: %s\n", str1); // before returnString: abc returnString(&str1); printf("after returnString: %s\n", str1); // before returnString: def return 0; }
沒有留言:
張貼留言