T:实现一段字符串从两端逐个向中间移动。
code:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
int main()
{
char arr1[] = "Welcome to 512";
char arr2[] = "##############";
int left = 0;
int right = strlen(arr1) - 1;
while (left <= right)
{
arr2[left] = arr1[left];
arr2[right] = arr1[right];
printf("%s\n", arr2);
left++;
right--;
}
return 0;
}
效果展现:
标签:right,语言,int,练习,char,arr2,arr1,日志,left From: https://blog.51cto.com/u_16003640/6123582