#include <stdio.h>
typedef struct {
int id;
int weight;
int height;
} Body;
void swap(Body data[]);
void display(Body data[]);
int main(void) {
Body data[] = {
{1, 65, 169},
{2, 73, 170},
{3, 59, 161},
{4, 79, 175},
{5, 55, 168}
};
swap(data);
display(data);
return 0;
}
void swap(Body data[]) {
Body temp;
for (int i = 0; i < 2; i++) {
temp = data[i];
data[i] = data[4 - i];
data[4 - i] = temp;
}
}
void display(Body data[]) {
for (int i = 0; i < 5; i++) {
printf("ID: %d, Weight: %d, Height: %d\n", data
[i
].
id, data
[i
].
weight, data
[i
].
height); }
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHN0cnVjdCB7CiAgICBpbnQgaWQ7CiAgICBpbnQgd2VpZ2h0OwogICAgaW50IGhlaWdodDsKfSBCb2R5OwoKdm9pZCBzd2FwKEJvZHkgZGF0YVtdKTsKdm9pZCBkaXNwbGF5KEJvZHkgZGF0YVtdKTsKCmludCBtYWluKHZvaWQpIHsKICAgIEJvZHkgZGF0YVtdID0gewogICAgICAgIHsxLCA2NSwgMTY5fSwKICAgICAgICB7MiwgNzMsIDE3MH0sCiAgICAgICAgezMsIDU5LCAxNjF9LAogICAgICAgIHs0LCA3OSwgMTc1fSwKICAgICAgICB7NSwgNTUsIDE2OH0KICAgIH07CgogICAgc3dhcChkYXRhKTsKICAgIGRpc3BsYXkoZGF0YSk7CgogICAgcmV0dXJuIDA7Cn0KCnZvaWQgc3dhcChCb2R5IGRhdGFbXSkgewogICAgQm9keSB0ZW1wOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCAyOyBpKyspIHsKICAgICAgICB0ZW1wID0gZGF0YVtpXTsKICAgICAgICBkYXRhW2ldID0gZGF0YVs0IC0gaV07CiAgICAgICAgZGF0YVs0IC0gaV0gPSB0ZW1wOwogICAgfQp9Cgp2b2lkIGRpc3BsYXkoQm9keSBkYXRhW10pIHsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgNTsgaSsrKSB7CiAgICAgICAgcHJpbnRmKCJJRDogJWQsIFdlaWdodDogJWQsIEhlaWdodDogJWRcbiIsIGRhdGFbaV0uaWQsIGRhdGFbaV0ud2VpZ2h0LCBkYXRhW2ldLmhlaWdodCk7CiAgICB9Cn0=
ID: 5, Weight: 55, Height: 168
ID: 4, Weight: 79, Height: 175
ID: 3, Weight: 59, Height: 161
ID: 2, Weight: 73, Height: 170
ID: 1, Weight: 65, Height: 169