S
sam
Please look at the code below
#include <stdio.h>
int expr(char str[], int i){
printf("%s \n",str);
return i;
}
int main()
{
if(expr("1st",1) || expr("2nd",0) && expr("3rd",1));
return 0;
}
output
-------
1st
As && has an higher precedence over ||
then it should call expr("2nd",0) or expr("3rd",0)
first then why it calls (expr("1st",1) first
Regards
Shiju
#include <stdio.h>
int expr(char str[], int i){
printf("%s \n",str);
return i;
}
int main()
{
if(expr("1st",1) || expr("2nd",0) && expr("3rd",1));
return 0;
}
output
-------
1st
As && has an higher precedence over ||
then it should call expr("2nd",0) or expr("3rd",0)
first then why it calls (expr("1st",1) first
Regards
Shiju