Gotchas

In this lesson, we'll point out some common unintentional mistakes that can be made in C.

We'll cover the following

There are a number of classic gotchas in C to watch out for when trying to figure out why your program is not running as expected (or not running at all). Check for these first when debugging, they are common.

Integer Math

Like Python, in C when you write mathematical expressions, be sure to include decimal places for all numbers (that is, unless you actually want to do integer math). What I mean is this. What do you think the following code will print to the screen?

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy