Lỗi:
Unhandled exception at 0x004960D6 in BTTT.exe: 0xC0000005: Access violation reading location 0xCCCCCCCC
Code:
#include <iostream>
using namespace std;
int main()
{
int b[10] = { 2, 4, 7, 2, 1, 7, 3, 9, 3, 6 };
int *a[10];
for (int i = 0; i < 10; i++)
{
a[i] = &b[i]; // gan dia chi cua so nguyen.
}
for (int i = 0; i < 10; i++)
{
cout << *a[i] << " ";
}
for (int i = 0; i<10; i++)
{
int j = i + 1;
if (*a[i]>*a[j])
{
swap(*a[i], *a[j]);
}
}
cout << endl;
for (int i = 0; i < 10; i++)
{
cout << b[i] << " ";
}
return 0;
}