@@ 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);
}