Logical Operators

Logical Operators are used for performing logical operations , such as joining(Or,And) conditions ,negations(Not).

Following table shows all the logical operators supported by C language.
OperatorsWhat They Do ..Precedence
!It gives the complement of all values. In C , all values are Positive(Boolean 1) except 0.1
&& Performs the AND operation on operands.2
||Performs the OR operation.3

C Example


int main() {

	int a=10,b=20,c=30,d,e,g,h,f;



	//  One condition false


	//  Both conditions  true


	//  One condition true

	h=((a>b)||(c< a));

	//  Both conditions false

	printf("a=%d , b=%d",a,b);

	printf("\n\nd=%d , e=%d",d,e);

	return 0;


Need to catch up your pending software project work? Access your online private workspace having your essential programming tools with virtual PC from www.CloudDesktopOnline.com with 24*7*365 days reliable tech-support from Apps4Rent.