#include <stdio.h> #include <stdlib.h> typedef struct Ball{ char color; double radius; }sBall; sBall balls[] = { {'r', 1.0}, {'g', 2.0}, {'b', 3.0} }; sBall balls2[] = {'a', 4.0}, {'b', 5.0}, {'c', 6.0} }; sBall *ptball; int main(void) { sBall ball3 = {'d', 4.0}; // sBall *ptr; // ptr = &ball; int a , i; a = 1; if(a == 1) { ptball = balls; } else if(a == 2) { ptball = balls2; } else { ptball = &ball3; } for(i=0;i<3;i++) printf("ball: %c\t%.2f\n", (ptball+i)->color , (ptball+i)->radius ); return 0; }