将字符数组A中下标为双号(0,2,4,5,8...)的元素值传给另一个字符数组B,然后将B数组的元素按逆序输出

时间:2022-10-13 19:54:47
 
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<Windows.h>
#include<stdio.h>


void main()
{
	char A[10] = "abcdefgihd";
	int B[10],j=0;
	for (int i = 0; i < 10; i++)//下标双号字符传递
	{
		if (i%2==0) B[j++] = A[i];
	}
	
	for (int i = j-1; i >=0; i--)//逆序打印结果
	{
		printf("%c", B[i]);
	}

	system("pause");
		

}