say i only have 1 structure declaration (a) that has 3 copies of say structure "Student". How can i swap "Student" around in the variable "a"?
I have
void swap(struct Student* a, int x, int y) {
struct Student *t = &a[x];
a[x] = a[y];
a[y] = *t;
}
I've tried multiple different combinations, but nothing im doing will swap the damn elements around.
Shouldn't it be like this? struct Student t = a[x]; a[x] = a[y]; a[y] = t;
Обсуждают сегодня