Chapter 3 Challenge


Hi all,

I’m having a little trouble with the challenge at the end of chapter 3. :blush: %f wasn’t explained in the example and I don’t know exactly what it does in this instance:

printf(“Cook it for %f minutes. /n”, cookingTime);

Do you have to use %f immediately after you have used a float variable?


%f is a Token but at this point you don’t need a deep understanding of %f as the book covers Tokens in detail in chapter 6.

The %f token in the printf function is just a place holder for the cookingTime. When you run the program the %f is replaced with the cookingTime value. The % is explained later in the book but f means it’s a float.

The book is great at explaining every piece of the code over time but it has a linear progression and that just means you will be doing somethings early on that you don’t fully understand but that is for a good reason because you need a foundation to learn from and they try and not overwhelm a beginner. This book is great at teaching you how to crawl, then walk, then run. Stick with it and keep reading and doing the exercises and it will start to get clearer; it’s tough at first but it pays off!


thanks I’ll keep going