#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void swap_string_ptr(char **s1, char **s2){
/* s1 と s2 のアドレスを交換する */
char *tmp;
tmp = *s1;
*s1 = *s2;
*s2 = tmp;
}
int main(void){
char *str1 = "ABC";
char *str2 = "123";
/* str1 と str2 の値(文字列の先頭アドレス)を交換 */
swap_string_ptr(&str1, &str2);
printf("str1=%s, str2=%s\n", str1, str2);
return 0;
}
I2RlZmluZSBfQ1JUX1NFQ1VSRV9OT19XQVJOSU5HUwojaW5jbHVkZSA8c3RkaW8uaD4KCnZvaWQgc3dhcF9zdHJpbmdfcHRyKGNoYXIgKipzMSwgY2hhciAqKnMyKXsgCiAgICAvKiBzMSDjgaggczIg44Gu44Ki44OJ44Os44K544KS5Lqk5o+b44GZ44KLICovCiAgICBjaGFyICp0bXA7CiAgICB0bXAgPSAqczE7CiAgICAqczEgPSAqczI7CiAgICAqczIgPSB0bXA7Cn0KCmludCBtYWluKHZvaWQpewogICAgY2hhciAqc3RyMSA9ICJBQkMiOwogICAgY2hhciAqc3RyMiA9ICIxMjMiOwoKICAgIC8qIHN0cjEg44GoIHN0cjIg44Gu5YCk77yI5paH5a2X5YiX44Gu5YWI6aCt44Ki44OJ44Os44K577yJ44KS5Lqk5o+bICovCiAgICBzd2FwX3N0cmluZ19wdHIoJnN0cjEsICZzdHIyKTsKCiAgICBwcmludGYoInN0cjE9JXMsIHN0cjI9JXNcbiIsIHN0cjEsIHN0cjIpOwoKICAgIHJldHVybiAwOwp9