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

PIC18F4550 ฆஈଣዚ C ႧԊணࠇྼਕ


                 Էνj

                   int score [3][4]={1,2,3,4,5,6,7,8,9,10,11,12};

                       ˸Ϥᗳપdɰ̙˸܁ѓɧၪ৬ΐd̥݊ܘˇϞዚึԴ͜Ցf


                 ■ 字串(字元陣列)

                       ί C ႧԊʕdοЕఱ݊͟οʩהଡ଼ϓٙ৬ΐdԨί௰ܝ̋ɪɓࡈ٤€nullοʩ
                 '\0'd܁ѓοЕࣛdஷ੬ٜટഗοЕڋ֐ʫ࢙d̙˸ɓࡈο͎ɓࡈο່͎֛ٙdӊࡈο

                 ͎˸ఊˏ໮ՒৎԸd್ܝ˸ஸ໮ʱකd௰ܝࠅ̋ɓࡈ٤οʩd್ܝ͜ɽܼ໮ՒৎԸf
                 א݊͜ᕐˏ໮ਗ਼዆ࡈοЕΐ̈dʔ̀̋٤οʩdᇜᙇኜึІБ̋ɪ̘dɰʔ̀͜ɽܼ
                 ໮fί܁ѓοʩ৬ΐࣛdʔ̀ί৬ΐୌ໮ [ ] ʕഗڗܓiԷνɨࠦٙ܁ѓ݊޴Νٙj


                   char abc[]={'h', 'e', 'l', 'l', 'o', '\0'};
                   char abc[]="hello";


                       ܁ѓʘܝఱ̙˸ٜટԴ͜ abc Ը˾ڌ༈οЕf


                   1-3-4  指標(Pointer)


                       ίଡ଼ΥႧԊʕdϞהፗٙගટ֛ѧd݊˸ݔɓࡈᅲπኜ຅ЪЗѧܸᅺd˸̴Ըܸ
                 Σݔাኳ᜗אᅲπኜٙЗѧਂ༟ࣘٙπ՟fᗫᒟίவࡈගટ֛ѧܸٙᅺᅲπኜ̙˸຾

                 ཀ༶ၑ€Էν჈ᄣא჈ಯϾ՟੻הซࠅπ՟ٙɓӻΐЗѧf

                       வ၇ගટ֛ѧٙዚՓdఱ݊ί C ႧԊʕܸٙᅺd̙ܸΣɓࡈাኳ᜗Зѧd࿁༈া
                 ኳ᜗ЗѧЪගટ዁Ъf

                       ᜊᅰఱ݊ɓࡈՈϞΤ၈ٙাኳ᜗٤ගdɓࡈᜊᅰ̍ў༟ࣘۨ࿒˸ᆽ֛াኳ᜗٤ග

                 ɽʃeᜊᅰ࠽˸່֛Ꮇπٙʫ࢙࠽ձᜊᅰΤ၈d˸˾ڌྼყ஗ৣໄٙᎷπ٤ගЗѧf
                 ್ܝ̙຾ᜊᅰΤ၈Ը՟੻༈ᜊᅰהܸٙЗѧʫ࢙f

                       ν؈ࠅٝ༸ݔࡈᜊᅰπίাኳ᜗ٙЗѧ€ʔ݊ʫ࢙d̙˸ίᜊᅰٙۃࠦ̋ɪ &
                 ୌ໮༶ၑɿd& ݊՟ѧ༶ၑɿ€Address-of operatord̙˸՟̈ᜊᅰٙাኳ᜗Зѧf


                 Էνj

                   unsigned char Var;
                   unsigned int VarAddr;
                   VarAddr = &Var;   //  VarAddr ٙʫ࢙ਗ਼݊ Var ίাኳ᜗ٙЗѧdϾʔ݊ʫ࢙ܸᅺ
                   ٙ܁ѓႧجf



             22
   27   28   29   30   31   32   33   34   35   36   37