Explain logical operators, C/C++ Programming

Assignment Help:

Logical Operators

We say any expression that evaluates to zero is a FALSE logic condition and that evaluating to non-zero value is a TRUE condition. Logical operators are useful in combining one or more conditions. The following are the logical operators :

                &&         AND

                ||           OR

                !              NOT

The first two operators are binary, while the exclamation(!) is a unary operator. It is used to negate the condition.

e.g.

                x<0 && y>10      evaluates to true if both conditions are

true

                x < 0 || z = = 0   evaluates to true, if one of the

conditions is true

                !(x == 0)                                               evaluates to true if condition is false.

The unary negation operator (!) has a higher precedence amongst the these, followed by the and (&&) operator and then the or(||) operator, and are evaluated from left to right.

 


Related Discussions:- Explain logical operators

Pointer declaration for class, P o i n t e r d e c l ...

P o i n t e r d e c l a r a t i o n f o r C l a s s : M m; M * p m; / / C la ss M i s d e c l a r e d a s

Should my class declare a friend function or member function, A: Use a memb...

A: Use a member while you can and a friend when you need to. Sometimes friends are better syntactically (e.g., in class Fred, friend functions let the Fred parameter to be secon

Function that have parameter and makes an integer mask, Write a function th...

Write a function that has an int parameter n, makes an integer mask having the bit 1 at the nth place from the rightmost bit, and returns the mask. For example, when n = 5 is passe

Word counting, Task Your task is to write a program, words, that reports i...

Task Your task is to write a program, words, that reports information about the number of words read from its standard input. For example, if the file qbf.txtcontains the text th

Recursion, #questiowrite a program to calculate e^x

#questiowrite a program to calculate e^x

Prime no., program to find if a no . is prime or not

program to find if a no . is prime or not

Explain function templates, Function Templates Function templates give ...

Function Templates Function templates give you with the capability to write a one function that is a skeleton, or template, for a family of similar functions. In function ov

Program to convert fraction to decimal, Program to convert fraction to deci...

Program to convert fraction to decimal: int main() {                 float num, denom;     // numerator and denominator of fraction                 float value;

Explain the function prototype - computer programming, Explain the Function...

Explain the Function Prototype? The Functions must be declared before they are used, ANSI C provides for the new function declaration syntax called as the function prototype,

Padovan string, A Padovan string P(n) for a natural number n is defined as:...

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd