C | The School of Code

Settings

Appearance

Choose a typography theme that suits your style

C

Learn the foundation of programming.

1

Hello World

C uses printf() for output. Include <stdio.h> for standard I/O.

Example

Run this example to see how it works and then try the exercise.

example.c
Loading...
Output
Click "Run" to see the example in action...
Exercise

Your task: Use printf() to print "Hello, World!"

main.c
Loading...
Output
Click "Run" to execute your code...
Quiz

What does stdio.h stand for?

SUMMARY

In this section, you learned how to print output to the console. Next, you'll learn how to declare variables and work with different data types.

2

Variables and Data Types

C has basic types. Use format specifiers in printf.

Example

Run this example to see how it works and then try the exercise.

example.c
Loading...
Output
Click "Run" to see the example in action...
Exercise

Your task: Declare age (int), height (float), grade (char)

main.c
Loading...
Output
Click "Run" to execute your code...
Quiz

Which format specifier is used for integers in C?

SUMMARY

In this section, you learned how to declare variables and work with different data types. Next, you'll learn how to use constants for values that don't change.

3

Constants

Constants are values that cannot change. Use const or #define.

Example

Run this example to see how it works and then try the exercise.

example.c
Loading...
Output
Click "Run" to see the example in action...
Exercise

Your task: Calculate area using PI * radius * radius

main.c
Loading...
Output
Click "Run" to execute your code...
Quiz

Which keyword creates a constant variable in C?

SUMMARY

In this section, you learned how to use constants for values that don't change. Next, you'll learn how to perform mathematical operations.

Unlock 10 More Lessons

You've completed the free preview! Upgrade to Pro to access all 12 lessons in this course, plus advanced projects and certificates.

Locked lessons:
  • Arithmetic Operators
  • If-Else Statements
  • For Loops
  • While Loops
  • Functions
  • Arrays
  • Pointers
  • Structs
  • Final Project: Student Grade System
Hello World 1
Variables and Data Types 2
Constants 3
Unlock 10 more lessons Access all content with Pro
Upgrade
Arithmetic Operators 4 If-Else Statements 5 For Loops 6 While Loops 7 Functions 8 Arrays 9 Pointers 10 Structs 11 Final Project: Student Grade System 12

Reset Progress?

Are you sure you want to reset all progress for this course? This action cannot be undone.