fork(3) download
  1. #include <iostream>
  2.  
  3. struct Pair {
  4. int first; int second;
  5. };
  6.  
  7. int main() {
  8. int N=5;
  9. int data[10]= {1,2,4,5,7,8,10,11,13,14};
  10. Pair *pairs = (Pair *)data;
  11.  
  12. for(int i=0; i<N; ++i)
  13. std::cout << i << ": (" << pairs[i].first << ", " << pairs[i].second << ")" << std::endl;
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
0: (1, 2)
1: (4, 5)
2: (7, 8)
3: (10, 11)
4: (13, 14)