#include <stdio.h>
#include <string.h>
#define N 80
void fun(char *s, char t[])
{int i, j=0;
for(i=0; i<(int)strlen(s); i++)
/***********found**********/
if(i%2 && s[i]%2==0)//if条件应该是判定字符是奇数位置或者ASCII码是偶数,或者用||
t[j++]=s[i];
/***********found**********/
t[i]='\0';//串的位置标志变量是j,原题给出的i是原串的位置标志变量,所以“t[i]='\0';”改为“t[j]='\0';”或“t[j]=0;”。
}
main()
{char s[N], t[N];
printf("\nPlease enter string s : "); gets(s);
fun(s, t);
printf("\nThe result is : %s\n",t);
}