Remember Values

Declare and use int, double, and char variables.

You now know how to print to the screen and perform basic math with C++. Now, let’s give your program a memory. In this lesson, you’ll learn how to create variables, containers for numbers, letters, or anything your program needs to remember.

Goal

You’ll aim to:

  • Declare variables using C++ types.

  • Store and reuse values.

  • Understand type basics: int, double, char.

Make a variable

To declare a variable in C++, we use the following simple syntax:

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy