I got errors:
qu2-1.c:66: warning: format '%s' expects type 'char *', but argument 2
has type 'char (*)[19u]'
qu2-1.c:72: warning: format '%s' expects type 'char *', but argument 2
has type 'char (*)[19u]'
but I don't quite know what it means...
<code/>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#define MAXPATIENTS 20
struct details {
int id;
char forename[20];
char initial;
char surname[20];
int day_of_entry;
int max_wait;
};
struct details patient[MAXPATIENTS];
int npatients = 0;
//Functions
int day_now(void);
int read_queue(void);
int list_patient(int index);
int queue_patient(struct details newpatient);
void list_queue();
void write_queue();
int insert_patient(int index, struct details newpatient);
int delete_patient(int index);
int find_patient_id(int id);
//Main starts here
int main (void) {
int Choice;
int id;
int index;
int n;
//Loop that continues the program
while(n < 0){
//To keep program running
//Displaying Menu
printf("\n\n");
printf("_________________________________________\ n");
printf("|-----------NHS Queue Control-----------|\n");
printf("| Create New Patient \t- Press 1\t|\n");
printf("| Delete Patient \t- Press 2\t|\n");
printf("| Find Patient \t\t- Press 3\t|\n");
printf("| List Queue \t\t- Press 4\t|\n");
printf("| Quit \t\t\t- Press 5\t|\n");
printf("|_______________________________________|\ n");
printf("Choice: ");
scanf("%d",&Choice);
printf("\n");
printf("%d \n",day_now());
//Choice made, carrying out function
switch (Choice){
//New Patient
case 1:
index = read_queue() + 1;
printf("Please enter the following details\n");
printf("Patient ID: ");
scanf("%d", &patient[index].id);
printf("Forename: ");
scanf("%s", &patient[index].forename);
printf("\n");
printf("Middle Initial: ");
scanf("%c", &patient[index].initial);
printf("\n");
printf("Surname: ");
scanf("%s", &patient[index].surname);
printf("\n");
printf("Day of Entry (Since 1/1/1970): ");
scanf("%d", &patient[index].day_of_entry);
printf("Maximum Waiting Time: ");
scanf("%d", &patient[index].max_wait);
insert_patient(index, patient[index]);
break;
........
int insert_patient(int index, struct details newpatient) {
//For testing only.....
printf("%d \n",patient[index].id);
printf("%s \n",patient[index].forename);
printf("%c \n",patient[index].initial);
printf("%s \n",patient[index].surname);
printf("%d \n",patient[index].day_of_entry);
printf("%d \n",patient[index].max_wait);
}