CBSE 2026 results are out, Mukul scored a perfect 100/100 in Computer ScienceSee all toppers →

KwickAcademy C · 8 min · free

Operators and Expressions in C

8 min4 KwickClipsFull text belowFree
Next lesson →Kajal Ma'am (MCA), teaching since 2004Remembered in this browser

C operators act on operands: arithmetic, relational, logical, assignment, increment, conditional and bitwise. Precedence decides which runs first; associativity decides for operators at the same level.

Follows the syllabus of: GSEB Std 10 Computer Studies

On screen in this lesson

Operators and operands

Operator: a symbol that does an action, like +
Operand: the value it acts on, like a and b
Expression: operators and operands together
Unary: 1 operand, binary: 2, ternary: 3

Relational operators

OperatorAsks10 ? 7 gives
==equal?0
!=not equal?1
> and <greater, less?1 and 0
>= and <=or equal?1 and 0

Logical operators

&& is AND: true only when both sides are true
is OR: true when at least one side is true
! is NOT: flips true to false, false to true

Prefix vs postfix rule

FormStepsa = 5, x gets
x = a++use, then add5
x = ++aadd, then use6
x = a--use, then subtract5
x = --asubtract, then use4

Bitwise operators

6 is 110 in binary, 3 is 011
6 & 3 = 2 (AND: 1 in both)
63 = 7 (OR: 1 in either)
6 ^ 3 = 5 (XOR: bits differ)
6 << 1 = 12, 6 >> 1 = 3, ~6 = -7

Precedence: who goes first

1. Unary ++ -- ! ~ (right to left)
2. * / % then + -
3. < <= > >= then == !=
4. && then
5. ?: then = += -= (right to left)

Quick answers

What is 2 + 3 * 4 in C?

14, because * runs before +.

If a = 5, what does b = a++ store in b?

5. Postfix uses the value first, then adds one.

KwickClips from this lesson

Short clips, one idea each. Good for revision the night before.

The full lesson, in text

Hello students, welcome to Kwickprep. What is two plus three into four? Is it twenty, or fourteen? C has a clear rule, and by the end of today you will know it. We will learn all the main operators, prefix and postfix, and the order in which C solves an expression.

First, a few terms. An operator is a symbol that does an action, like plus. An operand is the value the operator works on, like a and b in a plus b. An expression is a combination of operators and operands that gives one value. Operators are called unary, binary or ternary, when they take one, two or three operands.

Arithmetic operators do maths. Here a is seventeen and b is five. Plus gives twenty two, minus gives twelve, and star, which means multiply, gives eighty five. Slash divides, and because both are integers, seventeen by five gives three, not three point four. The percent sign is modulus, which gives the remainder, so it gives two.

Relational operators compare two values. In C, true is shown as one and false as zero. Double equals asks, are they equal, and ten double equals seven gives zero. Not equal gives one. Greater than gives one, and less than gives zero. Greater than or equal to, and less than or equal to, also say yes when the values are equal.

Logical operators join conditions. Double ampersand is AND, which is true only when both sides are true. Two vertical bars make OR, which is true when at least one side is true. The exclamation mark is NOT, which flips true to false and false to true. For example, marks greater than or equal to thirty three AND attendance greater than or equal to seventy five means both rules must pass.

One equals sign is the assignment operator, which stores a value, while double equals compares. C also has short forms. Minus equals means subtract and store. The wallet has five hundred rupees, and a recharge of one hundred ninety nine makes it three hundred one. Plus equals fifty adds cashback, so it prints three hundred fifty one.

The increment operator, plus plus, adds one to a variable. The decrement operator, minus minus, subtracts one. They are unary, because they need only one operand. Runs starts at ten, goes up to eleven, and back down to ten. The last line adds one again before printing, so it prints eleven.

Postfix means the plus plus comes after the name, and prefix means it comes before. Postfix uses the old value first, then adds one. So b gets five, and then a becomes six. Prefix adds one first, then uses the new value. So a becomes seven, and c gets seven. The output is seven, five, seven.

Here is the rule to remember, starting each time with a equal to five. With a plus plus after the name, x gets five, and then a becomes six. With plus plus before the name, a becomes six first, so x gets six. With minus minus after, x gets five. With minus minus before, x gets four.

The conditional operator is the only ternary operator in C, because it takes three parts. It is written as a condition, a question mark, one value, a colon, and another value. If the condition is true, the first value is chosen, otherwise the second. Age is seventeen, which is not eighteen or more. So ok gets zero, meaning this person cannot vote yet.

Bitwise operators work on the binary bits of a number. Six is one one zero in binary, and three is zero one one. Bitwise AND keeps bits that are one in both, giving two. Bitwise OR, a single bar, keeps bits that are one in either, giving seven. XOR, the caret, keeps bits that are different, giving five. Shift left doubles six to twelve, shift right halves it to three, and tilde flips every bit, giving minus seven.

Let us prove it with code. N is six and m is three. And gives two, or gives seven, XOR gives five, and shift left by one gives twelve. Do not mix up single ampersand, which is bitwise, with double ampersand, which is logical.

Precedence is the order in which C applies operators in one expression. First come unary operators like plus plus and NOT, which group right to left. Next come multiply, divide and modulus, and after them plus and minus. Then the relational operators, with less and greater before double equals. Then logical AND, and after it logical OR. Last come the conditional operator and assignment, which group right to left, and brackets always override this order.

What if two operators have the same precedence? Then associativity decides, which means the direction C works in. Most operators work left to right, so twenty minus five minus three is fifteen minus three, which is twelve. Assignment works right to left, so a equals b equals four first stores four in b, and then in a.

Pause and predict all three values. For x, multiply comes before plus, so three into four is twelve, plus two is fourteen. For y, the bracket goes first, so five into four is twenty. For z, divide and multiply have the same level, so we go left to right. Ten by three is three in integer division, and three into three is nine, not ten.

Let us revise what we learned today. C has arithmetic, relational, logical and assignment operators. Postfix a plus plus uses the value and then adds one, and prefix adds first. The conditional operator picks one of two values. Bitwise operators work on the bits of a number. And to solve any expression, apply precedence first, then associativity, and brackets beat both.

Courses that teach this

CourseUnit
GSEB Std 10 Computer StudiesProgramming Fundamentals & C Language
Programming All levels CData Types, Variables, and Operators

Voice-over in this lesson is AI-generated. The script is written and checked by Kajal Ma'am. Boards can revise a syllabus mid-year, so confirm anything you plan around against the official board circular. Keep your passwords, OTPs and ID numbers to yourself — we never ask for them. To reach Kajal Ma'am, use the WhatsApp button; sharing your number there is how we call you back.

Free to watch, no sign-up. Live classes with Kajal Ma'am are the paid course; these lessons stay free either way.

Want a plan that actually fits your board dates?

Ask Kajal Ma'am directly, 20+ years teaching computer science. Free demo class first, no payment.

Talk to Kajal Ma'am on WhatsApp

Or see the Class 12 Computer Science course →

Studying outside India?

We coach CBSE, IGCSE & international students across the globe, one-to-one, in your local time zone.

Visit International →