Category: 02. C

  • The sizeof Operator

    The sizeof operator is a compile−time unary operator. It is used to compute the size of its operand, which may be a data type or a variable. It returns the size in number of bytes. It can be applied to any data type, float type, or pointer type variables. When sizeof() is used with a data type, it…

  • Ternary Operator in C

    The ternary operator (?:) in C is a type of conditional operator. The term “ternary” implies that the operator has three operands. The ternary operator is often used to put multiple conditional (if-else) statements in a more compact manner. Syntax of Ternary Operator in C The ternary operator is used with the following syntax −…

  • Increment and Decrement Operators in C

    The increment operator (++) increments the value of a variable by 1, while the decrement operator (–) decrements the value. Increment and decrement operators are frequently used in the construction of counted loops in C (with the for loop). They also have their application in the traversal of array and pointer arithmetic. The ++ and — operators…

  • Unary Operators in C

    While most of the operators in C are binary in nature, there are a few unary operators as well. An operator is said to be unary if it takes just a single operand, unlike a binary operator which needs two operands. Some operators in C are binary as well as unary in their usage. Examples…

  • Assignment Operators in C

    In C language, the assignment operator stores a certain value in an already declared variable. A variable in C can be assigned the value in the form of a literal, another variable, or an expression. The value to be assigned forms the right-hand operand, whereas the variable to be assigned should be the operand to…

  • Bitwise Operators in C

    Bitwise operators in C allow low-level manipulation of data stored in computer’s memory. Bitwise operators contrast with logical operators in C. For example, the logical AND operator (&&) performs AND operation on two Boolean expressions, while the bitwise AND operator (&) performs the AND operation on each corresponding bit of the two operands. For the…

  • Logical Operators in C

    Logical operators in C evaluate to either True or False. Logical operators are typically used with Boolean operands. The logical AND operator (&&) and the logical OR operator (||) are both binary in nature (require two operands). The logical NOT operator (!) is a unary operator. Since C treats “0” as False and any non-zero…

  • Relational Operators in C

    Relational operators in C are defined to perform comparison of two values. The familiar angular brackets < and > are the relational operators in addition to a few more as listed in the table below. These relational operators are used in Boolean expressions. All the relational operators evaluate to either True or False. C doesn’t have a Boolean data…

  • Arithmetic Operators in C

    Arithmetic operators in C are certain special symbols, predefined to perform arithmetic operations. We are familiar with the basic arithmetic operations − addition, subtraction, multiplication and division. C is a computational language, so these operators are essential in performing a computerised process. In addition to the above operations assigned to the four symbols +, −, *, and / respectively, C…

  • Operators

    An operator is a symbol that tells the compiler to perform specific mathematical or logical functions. By definition, an operator performs a certain operation on operands. An operator needs one or more operands for the operation to be performed. Depending on how many operands are required to perform the operation, operands are called as unary, binary or ternary operators.…