Video Coming Soon...

Created by Zed A. Shaw Updated 2026-11-26 20:48:52

WARNING: This exercise needs a full review to match recent changes to C. If you find problems please report them with the bug feature (top right, bug icon).

05: C Operator Reference

This is less of an exercise you do and more a reference that gives you the names and purpose of the symbols and words you encounter in C code. There's two ways to use this, and both are valid at the same time:

  1. Read through this to get an idea of what's here, then continue with the course. When you see something you don't recognize come back here to find it. Knowing the names of things you use will help you remember them.
  2. Spend some time now memorizing these symbols so you're primed to know them later. Doing this can make it easier for you later when you code.

If you're the kind of impostor who doesn't actually know the names of things, then I suggest you take time and memorize them. This is especially true if you're like me and hate memorizing.

If you're the kind of impostor who will obsessively memorize everything and never actually do anything with the information then do not memorize these. Browse them, get the gist, and move on diving in and looking these up as you need.

How to Memorize

The best way to memorize something is a fairly simple process:

There are many other tricks to memorizing things, but I've found that this is the best way to build instant recall on things you need to be able to use immediately. The symbols, keywords, and syntax of C are things you need instant recall on, so this method is the best for this task.

Also remember that you need to do both sides of the cards. You should be able to read the description and know what symbol matches it, as well as the description for a symbol.

Finally, you don't have to stop while you're memorizing these operators. The best approach is to combine this with exercises in this book so you can apply what you've memorized. See the next exercise for more on this.

The List of Operators

The first operators are the arithmetic operators, which are very similar to almost every other programming language. When you write the cards, the description side should say that it's an arithmetic operator, and what it does.

Arithmetic OperatorDescription
+Add
-Subtract
*Multiply
/Divide
%Modulus
++Increment
--Decrement

Relational operators test values for equality, and again they are very common in programming languages.

Relational OperatorDescription
==Equal
!=Not equal
>Greater than
<Less than
>=Greater than equal
<=Less than equal

Logical operators perform logic tests, and you should already know what these do. The only odd one is the logical ternary, which you'll learn later in the book.

Logical OperatorDescription
&&Logical and
||Logical or
!Logical not
? :Logical ternary

Bitwise operators do something you likely won't experience often in modern code. They alter the bits that make up bytes and other data types in various ways. I won't cover this in my book, but they are very handy when working with certain types of lower level systems.

Bitwise OperatorDescription
&Bitwise and
|Bitwise or
^Bitwise xor
~Bitwise ones compliment
<<Bitwise shift left
>>Bitwise shift right

Assignment operators simply assign expressions to variables, but C combines a large number of other operators with assignment. So when I say and-equal, I mean the bitwise operators, not the logical operators.

Assignment OperatorDescription
=Assign equal
+=Assign plus-equal
-=Assign minus-equal
*=Assign multiply-equal
/=Assign divide-equal
%=Assign modulus-equal
<<=Assign shift-left-equal
>>=Assign shift-right-equal
&=Assign and-equal
^=Assign xor-equal
|=Assign or-equal

I'm calling these data operators but they really deal with aspects of pointers, member access, and various elements of data structures in C.

Data OperatorDescription
sizeof()Get the size of
[]Array subscript
&The address of
*The value of
->Structure dereference
.Structure reference

Finally, there are a few miscellaneous symbols that are either frequently used for different roles (like ,), or don't fit into any of the previous categories for various reasons.

Misc. OperatorDescription
,Comma
( )Parenthesis
{ }Braces
:Colon
//Single-line comment start
/*Multi-line comment start
*/Multi-line comment end

The Keywords

The keywords (also called a "lexeme") of a language make up words that augment the symbols so that the language reads well. There are some languages like APL that don't really have keywords. There are other languages like Forth and Lisp that are almost nothing but keywords. In the middle are languages like C, Python, Ruby, and many more that mix sets of keywords with symbols to create the basis of the language.

OperatorDescription
autoGive a local variable a local lifetime.
breakExit out of a compound statement.
caseA branch in a switch-statement.
charCharacter data type.
constMake a variable unmodifiable.
continueContinue to the top of a loop.
defaultDefault branch in a switch-statement.
doStart a do-while loop.
doubleA double floating point data type.
elseAn else branch of an if-statement.
enumDefine a set of int constants.
externDeclare an identifier is defined externally.
floatA floating point data type.
forStart a for-loop.
gotoJump to a label.
ifStarts an if-statement.
intAn integer data type.
longA long integer data type.
registerDeclare a variable be stored in a CPU register.
returnReturn from a function.
shortA short integer data type.
signedA signed modifier for integer data types.
sizeofDetermine the size of data.
staticPreserve variable value after its scope exits.
structCombine variables into a single record.
switchStart a switch-statement.
typedefCreate a new type.
unionStart a union-statement.
unsignedAn unsigned modifier for integer data types.
voidDeclare a data type empty.
volatileDeclare a variable might be modified elsewhere.
whileStart a while-loop.

Study your flashcards while you continue with the book. If you spent 15-30 minutes a day before studying, and another 15-30 minutes before bed, then you could most likely memorize all of these in a few weeks.

Previous Lesson Next Lesson

Register for From Impostor to Programmer

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.