Page 25 - PIC18F4550微處理機C語言設計實務
P. 25

૵ሔଡ଼ΥႧԊձ C ႧԊ 1




                                  變數型態                 所佔位元數             最小值              最大值
                        unsigned short                     16               0             65535

                        int, signed int                    16            –32768           32767
                        unsigned int                       16               0             65535

                        short  oat, signed short long      24            –8388608        8388607
                        unsigned short long                24               0            16777215
                                                                                            31
                        long, signed long                  32              –2 31          –2  – 1
                                                                                            32
                        unsigned long                      32               0              2  – 1

                 位元(Bit)資料型態的宣告

                       Зʩᜊᅰ bit ٙ܁ѓd̙˸ᜫ೻όணࠇ٫܁ѓɓࡈᜊᅰdՉᜊᅰɽʃ݊ɓࡈЗʩ

                 €bitdீཀவࡈ܁ѓމЗʩٙᜊᅰd̙˸࢙׸Ͼ˲ٜટٙπ՟ɓࡈЗʩf

                 字元(Character)資料型態的宣告

                       ίᜊᅰΤ၈ۃࠦᅺͪ chard͜ԸᎷπ 8 Зʩٙοʩא዆ᅰdοʩᇜᇁ˴ࠅԱ
                 ASCII ڌϾԸfீཀவࡈ܁ѓމοʩٙᜊᅰd̙˸࢙׸Ͼ˲ٜટٙπ՟ɓࡈЗʩଡ଼ٙ
                 ʫ࢙f


                 整數(Integer)變數資料型態的宣告

                       ίᜊᅰΤ၈ۃࠦᅺͪ int א long€ίఊ౺˪ʕ float ձ double Ԩʔ੬͜fϾ
                 short ձ int ί͉ࣣהʧୗԴٙ͜ᇜᙇኜʕdڗܓே݊ 16 ࡈЗʩdΪϤ short ఱʔ੬͜f

                 Ͼ long މ 4 Зʩଡ଼f
                       ՉʕϞ̋ᅺͪ unsigned ڌͪՉڗܓΌ௅͜Ըڌ͍ͪᅰd݂࿁׵ int ϾԊd࿁ᜊᅰ

                 abc ٙ܁ѓdԷνjsigned int abcdۆ੭ୌ໮ٙᜊᅰ abc Չᅰ࠽ٙڌͪᇍఖ݊ –32768 Ց
                 32767dϾ unsigned int Չᅰ࠽ٙڌͪᇍఖ݊ 0 Ց 65535f

                 浮點(Float)變數資料型態的宣告


                       ՈϞ 24 ࡈЗʩᄱܓٙ዆ᅰᜊᅰf

                 長整數(Long)變數資料型態的宣告

                       ՈϞ 32 ࡈЗʩᄱܓٙ዆ᅰᜊᅰf
                 signed 與 unsigned


                       ίᜊᅰ܁ѓٙۨ࿒ୌ໮ۃࠦ̋ɪ signed א unsigned ʱйڌͪ༈ᜊᅰ݊੭͍ࠋୌ໮
                 אʔ੭͍ࠋୌ໮f

                                                                                                             15
   20   21   22   23   24   25   26   27   28   29   30