问个题目!?求教!
程序代码:
#include <stdio.h> void reverse_string() { char *str = "abcd"; char *last_char; for(last_char = str; *last_char != '\0'; last_char++); last_char--; while(str < last_char) { char temp; temp = *str; *str++ = *last_char; *last_char-- = temp; } printf("%s\n",str); } int main() { reverse_string(); return 0; }
结果输不出来?
?????
求教
貌似地址跑到哪里去了?
不能用数组
实现字符串反向