Hi,
I was instructed to define the following structs:
Code:
typedef struct driver{
char name[101];
int priority;
struct driver* next;
}Driver;
typedef struct taxiSystem{
Driver * driversQueue;
Order * ordersQueue;
int numOrder;
}TaxiSystem;
And would now like to use the following function to determine whether a specific driver exists in the queue:
Code:
int addDriver(TaxiSystem * system, char * name, int priority)
{
int i = 0, j = 0;
if (name[j] == '\0') return 0;
return (system->driversQueue->name[i++] == name[j++]) ? addDriver(system, name, priority) : 0;
}
I realise the function is not programmed correctly. My question is simple - I am not very familiar with structs and the logic involved in handling them, ergo I am not quite certain how to access the string name in Drive. Do I need to use the pointer next (in Driver) for that? I'd appreciate some guidance.