#include <stdio.h> struct Case { char Name[100]; int CaseID; char CaseStatus[100]; struct Case *CasePointer; }; typedef struct Case* Pointer; void GetCaseInfo(Pointer ptr); void PrintOptions(); void PrintList(Pointer *ptr); void main( ) { int Option; Pointer head = NULL; Pointer p, q; head = (Pointer)malloc(sizeof(struct Case)); GetCaseInfo(head); PrintList(&head); PrintOptions(); scanf("%d", &Option); printf("\n"); while(Option != 3) { if(Option == 1) { p = (Pointer)malloc(sizeof(struct Case)); GetCaseInfo(p); p->CasePointer = head; head = p; p = NULL; } if(Option == 2) { if(head != NULL) { p = head; q = head->CasePointer; head = q; p->CasePointer = NULL; q = NULL; free(p); } } PrintList(&head); PrintOptions(); scanf("%d", &Option); printf("\n"); } } void PrintList(Pointer *ptr) { Pointer head; Pointer p; head = *ptr; p = head; while(p != NULL) { printf("%s\n", p->Name); printf("%d\n", p->CaseID); printf("%s\n", p->CaseStatus); p = p->CasePointer; printf("\n"); } } void GetCaseInfo(Pointer ptr) { printf("Enter customer's last name: "); scanf("%s", ptr->Name); printf("Enter Case ID : "); scanf("%d", &(ptr->CaseID)); printf("Enter status (no gaps) : "); scanf("%s", ptr->CaseStatus); printf("\n"); } void PrintOptions() { printf("Options:\n"); printf("(1) Add another case to the front the Link-List.\n"); printf("(2) Remove a case from the Link-List. \n"); printf("(3) Quit!\n"); printf("Select an option: "); }