Rules for declaring variable
To declare any variable in C language one must follow certain rules like:
- One must not use spaces in declaration of variables.
- Every variable should start from alphabet or underscore(_)
- Except underscore(_) no special characters is allowed.
- Variable must be at left side of assignment operator(=)
- No keyword must be declared as variable. For more information on keywords click here.
int a= 2
float m =2.97
Examples of invalid variables are:
Variable name | Reason for being invalid |
---|---|
int float = 2 | float is keyword |
int new number=89 | Space not allowed |
float variable&answer | No Special characters except |
No comments:
Post a Comment