Error in C programming
SitiNurAishahNu (0)

When ill try to run my program, this is the error appeared. How can i amend it?
main.c: In function ‘addNew’:
main.c:37:2: warning: implicit declaration of function ‘scanf_s’ [-Wimplicit-function-declaration]
scanf_s("%d", &numSeater);
main.c:46:10: warning: implicit declaration of function ‘strcpy_s’ [-Wimplicit-function-declaration]
case 1: strcpy_s(newNode->seater, sizeof(newNode->seater), "5 seater");

My code:
void addNew() {
int numSeater, numModel1, numModel2, numModel3;
char custID[15];
struct bookings newNode = (struct bookings) malloc(sizeof(struct bookings));
printf("Insert how many seater: \n[1] 4 seater\n[2] 8 seater\n[3] 12 seater");
printf("\nChoose [1]/[2]/[3] : ");
scanf_s("%d", &numSeater);
if (numSeater > 3) {
do {
printf("Invalid option.\nChoose: \n[1] 5 seater\n[2] 8 seater");
printf("\nChoose [1]/[2]/[3] : ");
scanf_s("%d", &numSeater);

You are viewing a single comment. View All
ArchieMaclean (831)

I think you are calling scanf_s but you haven't created that function/method. Also the same with strcpy_s.

Please mark this as the answer if it solved your problem :)