Sunday

Variable & Data Type

Variable & Data Type

Variable: A variable is a data name that may be used to store a data value.

     Primary data_type:

          Syntax:

               <data_type> <variable _name>; //declaration

                                                 or

               <data_type> <variable_name> = <Value>; //declaration & assignment

     User define data_type:

          typedef: “type definition” allows to users to define an identifier that would represent an existing data_type.

          Syntax:

                typedef <data_type> <identifier>;

          enum: “enumerated” data_type allows declaring variables that can have one of the values enclosed within the braces (known as “enumeration”).        

          Syntax:

                enum <identifier> {Value1, Value2, Value3, ...ValueN};

     <data_type>:

     <variable_name>:

  • Variable name must be beginning with the letter.Some systems permit underscore (“_”) as the first character.
  • ANSI standard recognize a length of 31 characters. But length should not be more than 8 characters, since only first 8 characters are treated as significant by compiler (C99 supports 63 characters).
  • Uppercase and lowercase are distinguished.
  • Variable name should not be a “keyword
  • White space” is not allowed.

No comments:

Post a Comment