已知Windows中是'\n'? ,那么在linux中是什么?問這個(gè)問題是因?yàn)樵趌inux中運(yùn)行這代碼輸出str1有亂碼.#include <stdio.h>int main(){??????? char str1[10],str2[10];??????? char *p1,*p2;??????? p1 = str1;??????? p2 = str2;??????? printf("輸入字符串\n");??????? gets(p2);??????? while(*(p2)!='\0')??????? {??????????????? *p1 = *p2;??????????????? p1++;??????????????? p2++;??????? }??????? p1 = '\0';??????? printf("str1 = %s\n",str1);??????? printf("str2 = %s\n",str2);??????? return 0;}
添加回答
舉報(bào)
0/150
提交
取消