Points to note in logical AND and OR operations

  • The logical AND (&&) has a higher priority than the logical OR (||)
  • When the value on the logical AND operation side is 0, no subsequent calculation will be performed;
  • When the value on one side of the logical OR operation is 1, no subsequent calculation will be performed;
#include<stdio.h>

int main()
{
    
    
	int a = 0, b = -1;
	printf("%d %d %d", a++ && b++, a, b); //输出结果:0 1 -1
	return 0;
}

Guess you like

Origin blog.csdn.net/Genius_bin/article/details/112313147