24-struct-arrow.c 248 B

1234567891011121314151617181920
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. typedef struct {
  4. int x;
  5. int y;
  6. } Point;
  7. int main() {
  8. Point *p = (Point *)malloc(sizeof(Point));
  9. p->x = 2;
  10. p->y = 3;
  11. printf("x: %d\n", p->x);
  12. printf("y: %d\n", p->y);
  13. free(p);
  14. return 0;
  15. }