[ create a new paste ] login | about

Link: http://codepad.org/Ew1DfNF4    [ raw code | output | fork ]

C, pasted on Aug 3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>

struct point {
  int x;
  int y;
};

struct point get_point(void *point_array, int index) {
  struct point s;
  s = ((struct point *)point_array)[index];
  return s;
}

int main() {
  struct point a[] = { {0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 5} }, s;
  s = get_point(a, 3);
  printf("%d, %d\n", s.x, s.y);
  return 0;
}
/* end */


Output:
1
3, 4


Create a new paste based on this one


Comments: