How to implement ternary operator in C++ without using conditional statements. In the following condition : a ? b : c If a is true,… Read More »
Comparing String using Relational operators, Using compare() Relational operators vs std::string::compare() Return Value : Relational operators return boolean value, while compare() returns unsigned integer. Parameters… Read More »
Unary operator: are operators that act upon a single operand to produce a new value. Types of unary operators: unary minus(-) increment(++) decrement(- -) NOT(!)… Read More »
Consider below C++ program and predict its output. The above invokes undefined behaviour by referencing both ‘i’ and ‘i++’ in the argument list. It is… Read More »
Given three integers a, b and c where c can be either 0 or 1. Without using any arithmetic, relational and conditional operators set the… Read More »
We can find size of an array using sizeof operator as shown below. // Finds size of arr and stores in ‘size’ int size =… Read More »
Consider below C++ program: Output: 3 The output for the above program is 3 since the “a” passed as argument to the “func” shadows the… Read More »
We have discussed introduction to operators in C and Arithmetic Operators. In this article, Relational and Logical Operators are discussed. Relational Operators: Relational operators are… Read More »
Operators are the foundation of any programming language. Thus the functionality of C language is incomplete without the use of operators. Operators allow us to… Read More »
Sizeof is a much used in the C programming language. It is a compile time unary operator which can be used to compute the size… Read More »
A Bitwise And operator is represented as ‘&’ and a logical operator is represented as ‘&&’. Following are some basic differences between the two operators.
Predict the output of following program:
In C, following 6 operators are bitwise operators (work at bit-level)
Operator precedence determines which operator is performed first in an expression with more than one operators with different precedence.
Predict the output of following C programs.