Example:- Int
x;--Here ‘x’
is the variable name.
Char y;--Here ‘y’ is the variable name.
Float k; --Here ‘k’ is the variable name.
·
Variable’s
value has not static or fixed.
Rules for Naming Variables in C :-
- Variable names should not have any embedded space or symbols such as ? ! @ # % ^ & + - * ( ) { } . , ; : “ ‘ / \. However, an underscores ‘_’ can be used wherever a space is required, For example:- ‘Dennis_Ritchie’.
- Variable names must be unique. (C is a case-sensitive language).
- A variable name must begin with a letter or an underscore. The first character in a variable name cannot be a digit.
- Keywords cannot be used as variable names. For example:- you cannot declare a variable named ‘void’ or ‘int’.
Examples of Variable Names :-
Data Types:- The type of data that can
be stored in a variable.
Char:- For character.
Int:- For integer.
Float:-
For numbers with decimals.
Data type
can be catagorized in two types:-
1.Value Type. Ex. Char,int.
2.Referance
Type. Ex. String.
Since
the above data types are represented at the machine level, the storage requirement
is hardware dependant. The following picture show the storage requirements for
the data types.
No comments:
Post a Comment
Thanks For Giving Comment In Our Blog.