how i can switch it into two single array ?

int busStop[4] = {25,50,89,67};
int ticketPrices[4] = {20,15,10,30};
I'm not sure what you meen...

1
2
3
4
5
//Like this?
int busStopsAndPrices[2][4] = {
  { 25, 50, 89, 67 },
  { 20, 15, 10, 30 }
};

1
2
3
4
5
6
7
8
9
10
11
12
//Or maybe, like this?
struct Bus {
  int stop;
  int price;
};

Bus buses[4] = {
  {25, 20},
  {50, 15},
  {89, 67},
  {67, 30}
};
Last edited on
you got it boss thanks
Topic archived. No new replies allowed.