为什么不执行下一条 if语句
程序使前边为奇数后面为偶数,问什么一直卡到红色的那条if语句而不向下执行
#include <iostream>
using namespace std;
void ReorderOddEven(int *pData, unsigned int length)
{
if(pData == NULL || length == 0)
return;
int *pBegin = pData;
int *pEnd = pData + length-1;
while(pEnd>pBegin){
if(*pBegin&0x01 == 1) pBegin++;
if(*pEnd&0x01 == 0) pEnd--;
if((*pBegin&0x01 == 0) &&(*pEnd&0x01 == 1)){
int temp = *pBegin;
*pBegin=*pEnd;
*pEnd=temp;
pBegin++;
pEnd--;
}
}
}
int main()
{
int pData[]={1,2,3,4,5,6,7,8};
ReorderOddEven(pData, 8);
for(int i=0; i<8; i++)
cout<<pData[i]<<endl;
system("pause");
return 0;
}