Category Archives: C

If-else Statement in C

Prerequisite – Control Statements in C In C, the “if-else” statement is used to execute one block of code if a certain condition is true, and a different block of code if the condition is false. Syntax: The basic syntax of the “if-else” statement in C is: Here, “condition” is any expression that evaluates to a boolean value… Read More »

If Statement in C

Prerequisite – Control Statements in C In C, the “if” statement is used to execute a block of code if a certain condition is true. Syntax of “if” statement: The basic syntax of the “if” statement in C is: Here, “condition” is any expression that evaluates to a boolean value (true or false). If the condition is true,… Read More »

Control Statements in C

Control statements in C are used to control the flow of program execution based on certain conditions. There are three main types of control statements in C: conditional statements, loop statements, and jump statements. 1. Conditional Statements: Conditional statements allow a program to make decisions based on whether a certain condition is true or false. The most common… Read More »

Comma Operator in C

Prerequisite – Operators in C The comma operator in C is an operator that allows multiple expressions to be evaluated sequentially in a single statement. Syntax: The syntax of the comma operator is as follows: expr1, expr2, …, exprn; Here, expr1, expr2, …, and exprn are expressions that are evaluated in order from left to right. The value… Read More »

Conditional Operator in C

Prerequisite – Operators in C The conditional operator in C is a ternary operator that is used to evaluate a boolean expression and return one of two values depending on whether the expression is true or false. Syntax: The syntax of the conditional operator is as follows: condition ? value_if_true : value_if_false; Here, condition is a boolean expression… Read More »

Bit-wise Operators in C

Prerequisite – Operators in C In C, bitwise operators are used to perform operations on the binary representation of numbers. These operators can be used to manipulate individual bits in a variable, which can be useful in certain situations such as when working with hardware or networking protocols. Types of Bit-wise Operators in C: There are six bitwise… Read More »

Logical Operators in C

Prerequisite – Operators in C In C, logical operators are used to perform logical operations on expressions that evaluate to either true (nonzero) or false (zero). They are typically used in conditional statements and loops to make decisions based on whether certain conditions are met or not. Types of Logical Operators in C: There are three logical operators… Read More »

Assignment Operators in C

Prerequisite – Operators in C In C, assignment operators are used to assign a value to a variable. They combine the assignment operation (=) with an arithmetic, bitwise, or other operation. Here are the assignment operators in C: List of Assignment Operators in C: Operator Example Equivalent to = a = b a = b += a +=… Read More »

Relational Operators in C

Relational operators in C are used for comparing values and determining whether they are equal, not equal, greater than, less than, greater than or equal to, or less than or equal to each other. Here is a list of relational operators in C: 1. Equal to (==): Returns true if the two operands are equal, false otherwise. In… Read More »

Arithmetic Operators in C

Arithmetic operators in C are used for performing mathematical operations, such as addition, subtraction, multiplication, and division. Here is a list of arithmetic operators in C: 1. Addition (+): Adds two operands together. 2. Subtraction (-): Subtracts one operand from another. 3. Multiplication (*): Multiplies two operands. 4. Division (/): Divides one operand by another. Note that if… Read More »