Back to Languages

C Tutorial

Learn C interactively. Read the concept and write code to practice.

1. C Introduction

C is a general-purpose programming language created by Dennis Ritchie at the Bel...

2. C Output (Print Text)

To output values or print text in C, you can use the `printf()` function. You c...

3. C Variables

Variables are containers for storing data values, like numbers and characters. I...

4. Format Specifiers

Format specifiers are used together with the `printf()` function to tell the com...

5. C Data Types

As explained previously, a variable in C must be a specified data type, and you ...

6. C Operators

Operators are used to perform operations on variables and values. C divides the...

7. If...Else

C has the following conditional statements: - `if` to specify a block of code to...

8. C Switch

Instead of writing many `if..else` statements, you can use the `switch` statemen...

9. While Loop

Loops can execute a block of code as long as a specified condition is reached. ...

10. For Loop

When you know exactly how many times you want to loop through a block of code, u...

11. C Arrays

Arrays are used to store multiple values in a single variable, instead of declar...

12. C Strings

Strings are used for storing text/characters. Unlike many other programming lan...

13. Memory Address & Pointers

When a variable is created in C, a memory address is assigned to the variable. Y...

14. C Functions

A function is a block of code which only runs when it is called. You can pass da...

15. Function Parameters

Information can be passed to functions as a parameter. Parameters act as variabl...

16. C Math

C provides a math library `<math.h>` to perform mathematical operations. To use...

17. C Structures (structs)

Structures (also called structs) are a way to group several related variables in...

18. C Enums

An enum is a special type that represents a group of constants (unchangeable val...

19. C Memory Allocation

C allows you to allocate memory manually. This is called dynamic memory allocati...

20. C File Handling

In C, you can create, open, read, and write to files by declaring a pointer of t...