# 数据结构中有关的逆置问题，vs2022代码运行问题？

``````#include<iostream>
#define maxsize 100
void seqlistR1(int seqlist[], int length)
{
int left = 0;
int right = length - 1;
for (left, right; left < right; left++, right--)
{
int temp = seqlist[left];
seqlist[left] = seqlist[right];
seqlist[right] = temp;
}
for (int a=0,int b=length-4; a <b; a++, b--)
{
int temp = seqlist[a];
seqlist[a] = seqlist[b];
seqlist[b] = temp;
}
}
void Printf(int seqlist[],int length)
{
for (int i = 0; i < length; i++)
{
std::cout << seqlist[i]<<" ";
}
}
int main()
{
int seqlist[maxsize] = { 1,2,3,4,5,6,7,8 };
int length = 8;
seqlistR1(seqlist, length);
Printf(seqlist,length);
return 0;
}``````

``````#include<iostream>
#define maxsize 100
void seqlistR1(int seqlist[], int length)
{
int left = 0;
int right = length - 1;
for (left, right; left < right; left++, right--)
{
int temp = seqlist[left];
seqlist[left] = seqlist[right];
seqlist[right] = temp;
}
}
void seqlistR2(int seqlist[], int length)
{
int left = 0;
int right = length - 4;
for (left, right; left < right; left++, right--)
{
int temp = seqlist[left];
seqlist[left] = seqlist[right];
seqlist[right] = temp;
}
}
void Printf(int seqlist[], int length)
{
for (int i = 0; i < length; i++)
{
std::cout << seqlist[i] << " ";
}
}
int main()
{
int seqlist[maxsize] = { 1,2,3,4,5,6,7,8 };
int length = 8;
seqlistR1(seqlist, length);
seqlistR2(seqlist, length);
Printf(seqlist, length);
return 0;
}``````

###### 你尚未登录，登录后可以
• 和开发者交流问题的细节
• 关注并接收问题和回答的更新提醒
• 参与内容的编辑和改进，让解决方法与时俱进