I am attempting to bubble sort the values in the array "A" using c++, but get error saying stack around variable A is corrupted?
#include <iostream>
#include <string>
using namespace std;
int main()
{
int A[] = {5,7,8,2,4,3};
for (int i = 1; i <= 7 - 1; i++)
{
for (int j = 7; j >= i + 1; j--)
{
if (A[j] < A[j - 1])
{
swap(A[j], A[j - 1]);
}
}
}
}