The C Character Set : Constants, Variables and Keywords

A character denotes any alphabet, digit or special symbol used to represent information. Here is the list of valid character set (Alphabets, Numbers and Symbols) allowed in C.

character set in c
character set in c

The alphabets, numbers and special symbols when properly combined form constants, variables and keywords. Let us see what are ‘constants’ and ‘variables’ in C.

Constant and Variable in C:

  • A constant is an entity that doesn’t change
  • A variable is an entity that may change.

In any program we typically do lots of calculations. The results of these calculations are stored in computers memory. Like human memory the computer memory also consists of millions of cells. The calculated values are stored in these memory cells. To make the retrieval and usage of these values easy these memory cells (also called memory locations) are given names. Since the value stored in each location may change the names given to these locations are called variable names.

Let’s have an example:

constant and variable in c
constant and variable in c
  1. Here 3 is stored in a memory location and a name x is given to it.
  2. Then we are assigning a new value 5 to the same memory location x.
  3. This would overwrite the earlier value 3, since a memory location can hold only one value at a time.
  4. Since the location whose name is x can hold different values at different times x is known as a variable.
  5. As against this, 3 or 5 do not change, hence are known as constants.

C Keywords:

  • Keywords are the words whose meaning has already been explained to the C compiler (or in a broad sense to the computer).
  • The keywords cannot be used as variable names because if we do so we are trying to assign a new meaning to the keyword, which is not allowed by the computer.
  • Some C compilers allow you to construct variable names that exactly resemble the keywords.However, it would be safer not to mix up the variable names and the keywords.
  • The keywords are also called ‘Reserved words’.
  • There are only 32 keywords available in C.
  • Below are the list of keywords used in C.
  • keywords in c
    keywords in c

Related Posts

  • 75
    Welcome to the C Knowledge Base and Tutorial   Introduction to C Programming Start Learning C Programming What is C? Why We should learn C C Character Set : Constants, Variables and Keywords Constant and Variable in C: C Keywords: Types of C Constant Rules for Constructing Integer Constants Rules…
    Tags: constants, variable, tutorial, constant, character, keywords, variables, names, set, learn
  • 53
    The three primary constants and variable types in C are integer, float and character. A variable name can be of maximum 31 characters. Do not use a keyword as a variable name. An expression may contain any sequence of constants, variables and operators. Operators having equal precedence are evaluated using…
    Tags: variable, constants, character, variables, learn, learinging, tutorial
  • 37
    An entity that may vary during program execution is called a variable. Variable names are names given to locations in memory. These locations can contain integer, real or character constants. In any language, the types of variables that it can support depend on the types of constants that it can handle. This…
    Tags: variable, names, tutorial, learn
  • 37
    C constants can be divided into two major categories: Primary Constants:  Secondary Constants: At this stage we would restrict our discussion to only Primary Constants, namely, Integer, Real and Character constants. Let us see the details of each of these constants. For constructing these different types of constants certain rules…
    Tags: constants, constant, character, tutorial, learn
  • 30
    We often require to do string manipulation on a variable. For example, a variable named phonenumber which represents a number we'd like to call, and we want to strip off the first 5 digit before dialing the number. Asterisk provides a special syntax for doing just that, which looks like ${variable[:skip[:length]} The…
    Tags: set, variable, variables

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: