InterviewSolution
| 1. |
Write the rules for forming a variable name. |
|
Answer» (i) Variable name consists of Setters, digits & underscore (_) (ii) Must begin with a letter. Some systems permit an underscore as the first character. (iii) ANSI standard recognizes a length of 31 characters. However, the length should not be normally more than 8 characters, since only the first eight characters are treated significant by the compiler. (iv) Uppercase and lowercase are significant, ie TOTAL is not same as total or (v) Variable name should not be a keyword. (vi) White space is not allowed. Example: Valid: temp, avg, sum1 ,total, ph value, T_raise, mark, i, j Invalid: 123,25th 5times, (area) abc$ char, int, group one abc-5 |
|