#include <stdio.h>
struct addressSheet {
int a, b;
};
void swap1(struct addressSheet ary[], int i, int j) {
struct addressSheet tmp;
tmp = ary[i];
ary[i] = ary[j];
ary[j] = tmp;
}
void swap2(struct addressSheet ary[], int i, int j) {
struct addressSheet *tmp;
tmp = &ary[i];
ary[i] = ary[j];
ary[j] = *tmp;
}
int main() {
static struct addressSheet addressSheetTable[] = {
{1, 11}, {2, 22}, {3, 33}, {4, 44}, {5, 55} };
int i;
int n = sizeof(addressSheetTable) / sizeof(addressSheetTable[0]);
for (i = 0; i < n / 2; i++)
swap1(addressSheetTable, i, n - 1 - i);
for (i = 0; i < n; i++)
printf("%d:%d\n", addressSheetTable[i].a, addressSheetTable[i].b);
putchar('\n');
for (i = 0; i < n / 2; i++)
swap2(addressSheetTable, i, n - 1 - i);
for (i = 0; i < n; i++)
printf("%d:%d\n", addressSheetTable[i].a, addressSheetTable[i].b);
return 0;
}
/* end */