间隔提取字符串字符
将字符数组str1种下标为偶数的元素赋值给另外一个字符数组str2。
/*
将字符数组str1种下标为偶数的元素赋值给另外一个字符数组str2。
*/
#include<stdio.h>
#define N 100
int main(){
char str1[N],str2[N];
scanf("%s",str1);
char *p=str1,*q=str2;
int len=0;
while(*p!='\0'){ len++; p++;}
p=str1;
while(p<=str1+len){
*q=*p;
p++;p++;
q++;
}
*q='\0';
printf("%s",str2);
return 0;
}