#include<stdio.h>
#include<string.h>
void odd_even(int*s,int len)
{
int tmp = 0;
int*p = s;
int i = 1;
while (len)
{
while (*p % 2 == 0)
{
p++;
len--;
}
//交换 s和p之间
if (*p % 2 != 0)
{
tmp = *p;
i = 1;
while (s <= (p - i))
{
*(p - i + 1) = *(p - i);
i++;
}
*s = tmp;
}
s++;
p++;
len--;
}
}
int main()
{
int s[] = { 2, 3, 4, 6, 7, 9, 8, 6, 5 };
int len = sizeof(s) / sizeof(s[0]);
int i = 0;
odd_even(s,len);
for (i = 0; i < len; i++)
{
printf("%d ", s[i]);
}
printf("\n");
system("pause");
return 0;
}