
#includevoid reverse(char* line) { int index=0; char temp[20]; char* swi; swi = line; while (*swi) { if (*swi == ' ') { swi++; continue; } else { temp[index] = *swi; swi++; index++; } } temp[index] = ''; puts(temp); index = 0; while (*(temp + index) != '') { *(line+index) = *(temp + index); index++; } *(line + index) = ''; } int main() { char a[20]; char* b; printf("please enter a line of characters:"); b = gets(a); while (a[0] != ' ') { reverse(b); puts(b); printf("Next line?(blank to quit)"); b = gets(a); } printf("bye"); }
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)