Variables

Learn how we can use variables to refer to our data.

We'll cover the following

Just as in other high-level programming languages, in C, we can assign symbolic names, known as variables, for storing information in memory. Then we can retrieve those pieces of information in memory by using those symbolic variable names, instead of having to use the raw addresses of memory locations where our data is stored. Variables can be used to store different types of data including floating-point numbers, characters, and even addresses of other memory locations.

Variable names

There are some restrictions on the names of variables in C. Names are made up of letters and digits, but the first character must be a letter (and not a digit). Here, we count the underscore _ as a letter. Also note that uppercase and lowercase letters are distinct and so Age is distinct from age.

Create a free account to access the full course.

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