Lesson 1 of 23

Your First C Program

7 min 20 XP

C is the mother of many languages: operating systems like Linux and Windows and countless embedded devices are written in it. Every C program starts at the main() function. printf() prints to the screen and needs #include <stdio.h>.

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

\n means new line; without it the next printf continues on the same line. Every statement ends with a semicolon, and return 0; tells the system the program finished successfully.

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

C is case-sensitive: printf works, Printf doesn't. When you see a compile error, check the line number for a missing semicolon first.

Challenge

+20 XP

Print these two lines exactly: Hello C I can code!

Output Loading C (first time takes a few seconds)
Press Run to see the result here.