C TutorialLesson 7Free preview
C Variables
This lesson is part of C · All levels
Summary
A variable is a named container for storing data that can change during the program's run. In C each variable must be declared by including its data type, e.g. int for integers or char for one character. The name of the variable should begin with a letter or underscore, should not precede a number, and should be used to give a clear meaning to the data. The value of a variable can be changed at any time during program execution.
Key points
- The declaration of variable C always includes data types, for example: int age;
- The name of the variable can only contain letters, numbers, and underscores, without the number prefix
- C is case-sensitive so the value and the value are different variables
- New variables should always be given a starting value before use to avoid a waste value
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.