My code seems to skip an if statement. The function code is here:
Code:
while(flag == 0)
{
if(strcmp(current_plane_fuel->name, temp_fuel->name)==0)
{
flag == 1;
}
temp_fuel = temp_fuel->next_fuel;
if(temp_fuel == NULL && flag == 0)
{
flag = 1;
check_result = 4;
}
}
It basically checks 2 char arrays and if they are the same breaks the while loop.
temp_fuel being a linked list of structs that hold a name.
It's just checking if the fuel exists.
If they are different it breaks the loop and sets the int "check_result" to 4.
Even when I give it words that are the same it gives me the result of 4. And when I debug it, I check both values and they are the same. As I step through I see it skip over the whole if statement.
It doesn't even place the debuggers current line on the "if(strcmp...etc" line.
I can post the function in more detail if it helps, but I can't see why it won't even check the first if statement.