I'm building a system of 2 servers and 1 client for reservations.
I found an obstacle, now I'll explain:
-server A
-server B
-client
Once the client selects from a menu what he wants to book and when,
server B must look in the struct for the date and check if it is available, if it is send an ok, if it is not send a no as an answer.
To do it I had thought of the following way, but it does not work:
bool search(int bet2, bool flag)
{
int i=0;
for(i=0; i < 11; i++){
if(strcmp(content[i].date, content[bet2].date) == 0)
{
if (content[i].mark == true)
{
printf("Date Busy");
return false;
} else {
content[i].mark = true;
printf("Date booked day: %s",content[i].date);
return true;
}}
}
}
in the prototypes I declare it so:
bool search (int bet2, bool flag);
in the main I declare it so:
search (bet2, flag);
the struct is this:
typedef struct choice {
char name [40];
char date [40];
bool mark;
} Choice;
Choice content [10];
now I have a doubt, but the type bool exists in C?
anyway, where am I wrong?
sorry but I'm writing lines of code this morning and I'm stuck here, probably I do not see it.
this code return ever that date is good, where am i wrong?