Programming In C, Rules for specifying a variable name in C Language?

 Topic: Programming In C

Question 1: What are the rules for specifying a variable name in C Language?

Ans: The following are the rules for specifying variable

names in c language.

  • A variable name begins with a letter or underscore (_) and may consists of letters, underscores and or digits.
  • The underscore may be used to improve readability of the variable name. For example over_time.
  • There is no restriction in the length of the variable name. However only 31 characters of a variable are significant.
  • Both upper case and lower letters are allowed in a variable name. e.g: AVG, avg, etc
  • Special characters cannot be used as variable name. e.g: @, ?
  • Reserved words of c language such as int , case, etc cannot be used as variable names.
  • There must be no embedded blank in the name of variable. For example ma ss is not correct.

Comments