i need help with if statement. for some reason its not working right and i dont know why. i never goesinside 2nd if statement.
i
i want to go inside this if statement - if left_var value is "2x"
//for loop iam start with x. b = 'x' and b-1 != '+','-'
if(left_var[b] == 'x' && (left_var[b-1] != '+' || left_var[b-1] != '-'))
i want to go inside this if statement if - if left_var value is "-x"
if(left_var[b] == 'x' && (left_var[b-1] == '+' || left_var[b-1]== '-'))
full code
void variables_to_num(char left_var[], char left_var_num[])
{
int b = 0;
int lv = 0;
int flag = 0;
for(b = 50 - 1; b > -1; b--)
{
if(left_var[b] != '\0')
{
if(left_var[b] == 'x' && (left_var[b-1] != '+' || left_var[b-1] != '-'))
{
}
if(left_var[b] == 'x' && (left_var[b-1] == '+' && left_var[b-1]== '-'))
{
//doesnt go here
}
}
}
}