Page 24 - Programming Microcontrollers in C
P. 24

Names        9

                          with an underscore. Because of this convention, you should avoid
                          the use of an underscore as the first character for either function or
                          variable names in your code. This approach will completely avoid
                          name conflict with these hidden or unexpected names. Compilers
                          usually allow the names to be unique in the first 31 characters. Un­
                          fortunately, some linkers used to link various program modules require
                          that the names be unique in the first six or eight characters, depend­
                          ing on the linker.
                              C has a collection of keywords that cannot be used for names.
                          These keywords are listed below:

                          KEYWORDS

                          auto            double           int             struct
                          break           else             long            switch

                          case            enum             register        typedef
                          char            extern           return          union
                          const           float            short           unsigned
                          continue        for              signed          void
                          default         goto             sizeof          volatile
                          do              if               static          while


            Types and Type Declarations
                              C has only a few built-in types. Here they are:

                              char—is usually eight bits. The character is the smallest stor­
                          age unit.

                              int—an integer is usually the size of the basic unit of storage
                          for the machine. An int must be at least 16 bits wide.

                              float—a single precision floating-point number.
                              double—a double precision floating-point number.
                              Additional qualifiers are used to modify the basic types. These
                          qualifiers include:
                              short—modifies an int, and is a variable whose width is no
                          greater than that of the int. For example, with a compiler with a 32
                          bit int a short int could be 16 bits. You will find examples
                          where short and int are the same size.
   19   20   21   22   23   24   25   26   27   28   29