Found 27104 Articles for Server Side Programming

What are equality operators in C++?

Nishtha Thakur
Updated on 11-Feb-2020 07:46:53

957 Views

The equality operators in C++ are is equal to(==) and is not equal to(!=). They do the task as they are named. The binary equality operators compare their operands for strict equality or inequality. The equality operators, equal to (==) and not equal to (!=), have lower precedence than the relational operators, but they behave similarly. The result type for these operators is bool.The equal-to operator (==) returns true (1) if both operands have the same value; otherwise, it returns false (0). The not-equal-to operator (!=) returns true if the operands do not have the same value; otherwise, it returns ... Read More

What is the difference between prefix and postfix operators in C++?

Smita Kapse
Updated on 11-Feb-2020 07:44:03

2K+ Views

In the prefix version (i.e., ++i), the value of i is incremented, and the value of the expression is the new value of i. So basically it first increments then assigns a value to the expression. In the postfix version (i.e., i++), the value of i is incremented, however, the {value|the worth} of the expression is that the original value of i. So basically it first assigns a value to expression and then increments the variable.Let's look at some code to get a better understanding −Example#include using namespace std; int main() {    int x = 3, y, z;   ... Read More

What are postfix operators in C++?

Anvi Jain
Updated on 11-Feb-2020 07:41:18

4K+ Views

Postfix operators are unary operators that work on a single variable which can be used to increment or decrement a value by 1(unless overloaded). There are 2 postfix operators in C++, ++ and --.In the postfix notation (i.e., i++), the value of i is incremented, but the value of the expression is the original value of i. So basically it first assigns a value to expression and then increments the variable. For example, Example#include using namespace std; int main() {    int j = 0, i = 10;    // If we assign j to be i++, j ... Read More

What are shift operators in C++?

Nitya Raut
Updated on 11-Feb-2020 07:39:27

6K+ Views

The bitwise shift operators are the right-shift operator (>>), which moves the bits of shift_expression to the right, and the left-shift operator (

What are multiplicative operators in C++?

Jennifer Nicholas
Updated on 11-Feb-2020 07:37:45

187 Views

The multiplicative operators are −Multiplication (*)Division (/)Modulus or “remainder from division” (%)These binary operators have left-to-right associativity. The multiplicative operators take operands of arithmetic sorts. The modulus operator (%) contains a stricter requirement in this its operands should be of integral type.The multiplication operator yields the result of multiplying the first operand by the second.The division operator yields the result of dividing the first operand by the second.The modulus operator yields the remainder given by the subsequent expression, wherever e1 is that the 1st operand and e2 is that the second: e1 – (e1 / e2) * e2, where both ... Read More

What is Bitwise OR in C++?

Vrundesha Joshi
Updated on 11-Feb-2020 07:31:31

119 Views

The bitwise OR operator (|) compares each bit of first operand to the corresponding bit of second operand. If either bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0. Both operands to the bitwise inclusive OR operator must be of integral types. For example,Example#include   using namespace std;   int main() {      unsigned short a = 0x5555;      // pattern 0101 ...      unsigned short b = 0xAAAA;      // pattern 1010 ...      cout

What is Bitwise AND in C++?

Rishi Rathor
Updated on 11-Feb-2020 07:30:01

126 Views

The bitwise AND operator (&) compares each bit of first operand to the corresponding bit of second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0. Both operands to the bitwise inclusive AND operator must be of integral types. For example,Example#include   using namespace std;   int main() {      unsigned short a = 0x5555;      // pattern 0101 ...      unsigned short b = 0xAAAA;      // pattern 1010 ...      cout

What is Bitwise XOR in C++?

Daniol Thomas
Updated on 11-Feb-2020 07:23:15

220 Views

The bitwise exclusive OR operator (^) compares every bit of} its 1st operand to the corresponding bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0. Both operands to the bitwise exclusive OR operator must be of integral types. For example,Example#include   using namespace std;   int main() {      unsigned short a = 0x5555;      // pattern 0101 ...      unsigned short b = 0xFFFF;      // pattern 1111 ...      cout  

What is overloading a unary operator in C++?

Krantik Chavan
Updated on 11-Feb-2020 07:21:47

234 Views

The single operators operate on one quantity and following are the samples of single operators − - The increment ( ) and decrement (--) operators. The compiler distinguishes between the different meanings of an operator by examining the types of its operands.The unary operators operate on a single operand and following are the examples of Unary operators −The increment (++) and decrement (--) operators.The unary minus (-) operator.The logical not (!) operator.The unary operators operate on the object for which they were called and normally, this operator appears on the left side of the object, as in !obj, -obj, and ... Read More

Overloading unary operators + in C++

V Jyothi
Updated on 11-Feb-2020 07:12:45

199 Views

The operator keyword declares a function specifying what operator-symbol means that once applied to instances of a class. this gives the operator more than one meaning, or "overloads" it. The compiler distinguishes between the different meanings of an operator by examining the types of its operands.The unary operators operate on a single operand and following are the examples of Unary operators −The increment (++) and decrement (--) operators.The unary minus (-) operator.The logical not (!) operator.The unary operators operate on the object for which they were called and normally, this operator appears on the left side of the object, as ... Read More

Advertisements