#include #include #include "sec2_struct.h" typedef struct { int key1; int key2; } Section2Struct, *Section2StructPtr; Section2StructPtr sec2struct_construct(int key1_arg, int key2_arg) { // allocate space for the the Section2Struct, caller will have to // handle freeing the memory Section2Struct temp; Section2StructPtr result_struct = malloc(sizeof(temp)); result_struct->key1 = key1_arg; result_struct->key2 = key2_arg; return result_struct; } void sec2struct_print(Section2StructPtr sec2struct) { printf("This struct contains the elements : \n"); printf("key 1 : %d\n", sec2struct->key1); printf("key 2 : %d\n", sec2struct->key2); } void sec2struct_destroy(Section2StructPtr sec2struct) { free(sec2struct); // style thing doesnt really do anything sec2struct = NULL; }