Type
A variable is a seqeuence of program code with a name (also called its identifier). A name or identifier in C can be anything from a single letter to a word. The name of a variable must begin with an alphabetic letter or the underscore _ character but the other characters in the name can be chosen from the following groups:a .. z
(any letter from a to z)
A .. Z
(any letter from A to Z)
0 .. 9
(any digit from 0 to 9)
_
(the underscore character)
Some examples of valid variable names are:
a total Out_of_Memory VAR integer etc...
This serves two purposes:
• It gives a compiler precise information about the amount of memory that will have to be given over to a variable when a program is finally run and what sort of arithmetic will have to be used on it (e.g. integer only or floating point or none).
• It provides the compiler with a list of the variables in a convenient place so that it can cross check names and types for any errors.
0 comments:
Post a Comment