// c8--20
// void Sort(char **p)
// {
// char *temp;
// for (int i = 0; i < 5; i++)
// {
// for (int j = i + 1; j < 5; j++)
// {
// if (strcmp(*(p + i), *(p + j)) > 0)
// {
// temp = *(p + i);
// *(p + i) = *(p + j);
// *(p + j) = temp;
// }
// }
// }
// }
// int main(int argc, char const *argv[])
// {
// char str[5][10] = {"China", "American", "Asia", "Europe", "English"}, **p, *pstr[5];
// for (int i = 0; i < 5; i++)
// {
// pstr[i] = str[i];
// }
// p = pstr;
// Sort(p);
// for (int i = 0; i < 5; i++)
// {
// cout << pstr[i] << endl;
// }
// return 0;
// }
// c8--21
void Sort(int **p, int n)
{
int *t;
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
if (**(p + i) > **(p + j))
{
t = *(p + i);
*(p + i) = *(p + j);
*(p + j) = t;
}
}
}
}
int main(int argc, char const *argv[])
{
int a[10] = {21, 12, 9, 3, 18, 2, 4, 1, 19, 32}, *pa[10], **p, n = 10;
for (int i = 0; i < n; i++)
{
pa[i] = &a[i];
}
p = pa;
Sort(p, n);
for (int i = 0; i < n; i++)
{
cout << *p[i] << " ";
}
return 0;
}