Variable in C language
A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.
will be the following basic variable types −
To Indicate The Storage Area,Each Variable Should be Given A Unique Name (Identifier).Variable Names Are Just The Symbolic Representation Of A Memory Location.Variable names are just the symbolic representation of a memory location. For example:
int StudentMArks=72;
Here [StudentMarks] is a variable of int type.Here the variable assigned an integer value 72.
The name of a variable can be composed of letters, digits, and the underscore character. It must begin with either a letter or an underscore. Upper and lowercase letters are distinct because C is case-sensitive. Based on the basic types explained in the previous chapter, there
Rules of naming Variable
- Variable are case sensitive
- A variable name can only have letters (both uppercase and lowercase letters), digits and underscore.
- The first letter of a variable should be either a letter or an underscore.
- There is no rule on how long a variable name (identifier) can be. However, you may run into problems in some compilers if the variable name is longer than 31 characters
The name of a variable can be composed of letters, digits, and the underscore character. It must begin with either a letter or an underscore. Upper and lowercase letters are distinct because C is case-sensitive. Based on the basic types explained in the previous chapter, there will be the following basic variable types −
- Integer
- Character
- float
- Double
- void
- decimal
- Octal
- hexadecimal
Comments
Post a Comment