Getting Started With C

What Is a Variable in C?

Variables store different kind of data in the computer's memory, and take up a certain amount of space.

How to Declare Variables in C

Let's take the following example:

Program.c


  • In the example above, I declared a variable named age that will hold integer values.
  • What Are the Naming Conventions for Variables in C?

    How to Initialize Variables in C

    Program.c


    I initialized the variable age by assigning it an integer value of 29. With that said, you can combine the initialization and declaration steps instead of performing them separately:

    Program.c


    How to Update Variable Values in C

    Program.c


    Program.c


    Resources :

    Test Your Knowledge
    Choose The

    With supporting text below as a natural lead-in to additional content.

    Q1. A variable name can have ?

    Q2. Which pair of symbols is used to define the scope of functions, loops, and other code blocks in C?