Appendix B. C Topics: Revision roundup
![image with no caption](/api/v2/epubs/9781449335649/files/httpatomoreillycomsourceoreillyimages1711473.png.jpg)
Ever wished all those great C facts were in one place?
This is a roundup of all the C topics and principles weâve covered in the book. Take a look at them, and see if you can remember them all. Each fact has the chapter it came from alongside it, so itâs easy for you to refer back if you need a reminder. You might even want to cut these pages out and tape them to your wall.
Basics
Simple statements are commands. |
if statements run code if something is true. |
You can combine conditions together with && and ||. |
#include includes external code for things like input and output. |
Block statements are surrounded by { and }. |
switch statements efficiently check for multiple values of a variable. |
Every program needs a main function. |
Your source files should have a name ending in .c. |
You need to compile your C program before you run it. |
You can use the && operator on the command line to only run your program if it compiles. |
count++ means add 1 to count. |
while repeats code as long as a condition is true. |
for loops are a more compact way of writing loops. |
gcc is the most popular C compiler. |
-o specifies the output file. |
count-- means subtract 1 from count. |
do-while loops run code at least ... |
Get Head First C now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.