~learax/csci112-2021-william-culhane

419f3b9b902aef8d1665c12a65efa43c5f93babd — William Culhane 3 years ago d1b7931 classwork11
classwork11: Finish assignment
1 files changed, 20 insertions(+), 2 deletions(-)

M classwork/classwork11/classwork11.c
M classwork/classwork11/classwork11.c => classwork/classwork11/classwork11.c +20 -2
@@ 1,4 1,5 @@
#include <stdio.h>
#include <stdlib.h>

/*
 * William Culhane


@@ 6,8 7,25 @@
 * Tue Jun  1 10:18:05 AM MDT 2021
 */

typedef struct {
  int x, y;
} point_t;

int main(void) {
  // TODO
  // Declare pointer to struct
  point_t* ppoint;

  // Allocate 8 bytes (4 for each 32-bit int)
  ppoint = malloc(2 * 4);

  // Set the values
  ppoint->x = 5;
  ppoint->y = -12;

  // Print output
  printf("X: %i, Y: %i\n", ppoint->x, ppoint->y);

  return (0);
  // Free and exit
  free(ppoint);
  return(0);
}