Author: admin

  • Decision Making

    Every programming language including C has decision-making statements to support conditional logic. C has a number of alternatives to add decision-making in the code. Any process is a combination of three types of logic − A computer program is sequential in nature and runs from top to bottom by default. The decision-making statements in C provide an alternative…

  • Misc Operators

    Besides the main categories of operators (arithmetic, logical, assignment, etc.), C uses the following operators that are equally important. Let us discuss the operators classified under this category. The “&” symbol, already defined in C as the Binary AND Operator copies a bit to the result if it exists in both operands. The “&” symbol is also…

  • Operator Precedence in C

    A single expression in C may have multiple operators of different types. The C compiler evaluates its value based on the operator precedence and associativity of operators. The precedence of operators determines the order in which they are evaluated in an expression. Operators with higher precedence are evaluated first. For example, take a look at…

  • 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…