1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#include <stdio.h> typedef struct { int winner; int loser; } pair; int sub(pair*); const MAX = 9; int main(void) { pair pairs[MAX]; return sub(pairs); } int sub(pair* pairs) { pair* p = &pairs[8]; (*p).winner = 100; (p)->loser = 101; printf("pairs[8].winner %d\n", pairs[8].winner); printf("pairs[8].loser %d\n", pairs[8].loser); return 0; } |
1 2 |
pairs[8].winner 100 pairs[8].loser 101 |