what is "typedef" in c++

1,449 views

Published on

介绍在C++中Typedef关键词的使用

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,449
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

what is "typedef" in c++

  1. 1. Ä ^{ typedef ;.A^ typedef A:¯K typedef (Š typedef ´Ÿo Sx yankchina@gmail.com ÀHŒÆgÄzÆ 2008-04-28 yankchina@gmail.com What is typedef
  2. 2. Ä ^{ typedef ;.A^ typedef A:¯K typedef (Š ̇SN typedef Ä ^{ 1 Ξ C Šó {z a. O¶ ½Â² Ã'a. {zE,(² typedef ;.A^ 2 ª² a.½Â £N¼ê typedef A:¯K 3 typedef†define «O typedef •;ìá5 typedef†const (Š 4 yankchina@gmail.com What is typedef
  3. 3. Ä ^{ Ξ C Šó {z typedef ;.A^ a. O¶ typedef A:¯K ½Â² Ã'a. typedef (Š {zE,(² ̇SN typedef Ä ^{ 1 Ξ C Šó {z a. O¶ ½Â² Ã'a. {zE,(² typedef ;.A^ 2 ª² a.½Â £N¼ê typedef A:¯K 3 typedef†define «O typedef •;ìá5 typedef†const (Š 4 yankchina@gmail.com What is typedef
  4. 4. Ä ^{ Ξ C Šó {z typedef ;.A^ a. O¶ typedef A:¯K ½Â² Ã'a. typedef (Š {zE,(² Ξ C Šó {z •Ð C Šó¥‡½Â struct žéæ† s t r u c t tagPOINT{ int x , y ; }; s t r u c t tagPOINT p ; // c s t y l e d e f i n i t i o n Œ±^ typedef 5{zù ½Â•ª t y p e d e f s t r u c t tagPOINT{ int x , y ; }POINT ; POINT p ; // c s t y l e d e f i n i t i o n ù Ò' 5 •ª ˜ struct §5¿ struct 3 C ¥¢S þŒ± [ C + + class §ùž typedef Òƒ k^ £‡ éXe˜‡Š^¤ yankchina@gmail.com What is typedef
  5. 5. Ä ^{ Ξ C Šó {z typedef ;.A^ a. O¶ typedef A:¯K ½Â² Ã'a. typedef (Š {zE,(² ̇SN typedef Ä ^{ 1 Ξ C Šó {z a. O¶ ½Â² Ã'a. {zE,(² typedef ;.A^ 2 ª² a.½Â £N¼ê typedef A:¯K 3 typedef†define «O typedef •;ìá5 typedef†const (Š 4 yankchina@gmail.com What is typedef
  6. 6. Ä ^{ Ξ C Šó {z typedef ;.A^ a. O¶ typedef A:¯K ½Â² Ã'a. typedef (Š {zE,(² a. O¶ ù´ typedef §5¿ÙØ´{ü ÷½Â§ ´ï á ˜‡#a.quot;¤±ÙþŒ±ïá õ a.u Å›§èF 5†S 5ÑpNõquot; 'X‡(²,‡• a.§ØU c h a r ∗ pa , pb ; AT t y p e d e f c h a r ∗ PCHAR ; PCHAR pa , pb ; yankchina@gmail.com What is typedef
  7. 7. Ä ^{ Ξ C Šó {z typedef ;.A^ a. O¶ typedef A:¯K ½Â² Ã'a. typedef (Š {zE,(² ̇SN typedef Ä ^{ 1 Ξ C Šó {z a. O¶ ½Â² Ã'a. {zE,(² typedef ;.A^ 2 ª² a.½Â £N¼ê typedef A:¯K 3 typedef†define «O typedef •;ìá5 typedef†const (Š 4 yankchina@gmail.com What is typedef
  8. 8. Ä ^{ Ξ C Šó {z typedef ;.A^ a. O¶ typedef A:¯K ½Â² Ã'a. typedef (Š {zE,(² ½Â² Ã'a. • Jp§S £‡5§.^ typedef 5½Â² Ã'a .§X t y p e d e f l o n g d o u b l e REAL ; REAL v a l u e ; // t y p e d e f d o u b l e REAL ; // t y p e d e f f l o a t REAL ; ª² ž§•‡?U typedef ÒŒ± §3IO¥ ST L ¥Ò Œþ¦^ TE|§X sizet quot; yankchina@gmail.com What is typedef
  9. 9. Ä ^{ Ξ C Šó {z typedef ;.A^ a. O¶ typedef A:¯K ½Â² Ã'a. typedef (Š {zE,(² ̇SN typedef Ä ^{ 1 Ξ C Šó {z a. O¶ ½Â² Ã'a. {zE,(² typedef ;.A^ 2 ª² a.½Â £N¼ê typedef A:¯K 3 typedef†define «O typedef •;ìá5 typedef†const (Š 4 yankchina@gmail.com What is typedef
  10. 10. Ä ^{ Ξ C Šó {z typedef ;.A^ a. O¶ typedef A:¯K ½Â² Ã'a. typedef (Š {zE,(² {zE,(² typedef •p? ^{3u{zE,(²§Ù2•A^3 /•.0§S¥quot;duÙ†/÷0é C§ …Š{¿ÂÄ–§ ´•J± Ö†n) quot;ùÒ‡ ) typedef $1 Å›quot;X t y p e d e f v o i d ( ∗ pFunParam ) ( ) ; t y p e d e f v o i d ( ∗ pFunx ) ( pFunParam ) ; pFunx b [ 1 0 ] ; ´Ÿo¿g§ÙqTXÛ^Qº yankchina@gmail.com What is typedef
  11. 11. Ä ^{ Ξ C Šó {z typedef ;.A^ a. O¶ typedef A:¯K ½Â² Ã'a. typedef (Š {zE,(² E,(² Ö•{ /m† K0µlCþ¶wå§k m§2 †§- ˜‡ )ÒÒN= Ö ••¶)ÒS©Û ÒaÑT)Ò§„´U km †•ª†–(åquot;'X t y p e d e f i n t ( ∗FUNC ) ( i n t ∗ ) ; ù´˜‡k˜‡ ê• ëê …ˆ£Š• ê ¼ê• §ù 2 Öe¡ “èÒÐà FUNC p ; ^ typedef •{5(²˜‡¼ê• LK' ©•{•Ð FUNC p [ 5 ] ; // / i n t ( ∗ p [ 5 ] ) ( i n t ∗ ) ; yankchina@gmail.com What is typedef
  12. 12. Ä ^{ Ξ C Šó {z typedef ;.A^ a. O¶ typedef A:¯K ½Â² Ã'a. typedef (Š {zE,(² typedef kÏuMï² Ã'a.§$–UÛõE,ÚJun) Š{§;•jquot;§l ¦“è•èFquot; yankchina@gmail.com What is typedef
  13. 13. Ä ^{ typedef ;.A^ ª² a.½Â typedef A:¯K £N¼ê typedef (Š ̇SN typedef Ä ^{ 1 Ξ C Šó {z a. O¶ ½Â² Ã'a. {zE,(² typedef ;.A^ 2 ª² a.½Â £N¼ê typedef A:¯K 3 typedef†define «O typedef •;ìá5 typedef†const (Š 4 yankchina@gmail.com What is typedef
  14. 14. Ä ^{ typedef ;.A^ ª² a.½Â typedef A:¯K £N¼ê typedef (Š ª² a.½Â typedef ¦^•õ /•´Mï´uPÁ…£‡ a. ¶quot;X typedef int size ; v o i d measure ( s i z e ∗ p s z ) ; size array [ 4 ] ; yankchina@gmail.com What is typedef
  15. 15. Ä ^{ typedef ;.A^ ª² a.½Â typedef A:¯K £N¼ê typedef (Š ̇SN typedef Ä ^{ 1 Ξ C Šó {z a. O¶ ½Â² Ã'a. {zE,(² typedef ;.A^ 2 ª² a.½Â £N¼ê typedef A:¯K 3 typedef†define «O typedef •;ìá5 typedef†const (Š 4 yankchina@gmail.com What is typedef
  16. 16. Ä ^{ typedef ;.A^ ª² a.½Â typedef A:¯K £N¼ê typedef (Š £N¼ê typedef ~^u ¼ê• §3½Â£N¼êžÙ J •Ðquot; t y p e d e f i n t ( ∗ PF ) ( c o n s t c h a r ∗ , c o n s t c h a r ∗ ) ; PF R e g i s t e r ( PF p f ) ; XJØ^ typedef 5½Â¼ê• §KÙ(²Òé„¡ i n t (∗ R e g i s t e r ( i n t (∗ pf ) ( const char ∗ , const char ∗ ) ) yankchina@gmail.com What is typedef
  17. 17. Ä ^{ typedef typedef† define « O † ;.A^ typedef typedef •; ì á5 A:¯K typedef † typedef† const (Š ̇SN typedef Ä ^{ 1 Ξ C Šó {z a. O¶ ½Â² Ã'a. {zE,(² typedef ;.A^ 2 ª² a.½Â £N¼ê typedef A:¯K 3 typedef†define «O typedef •;ìá5 typedef†const (Š 4 yankchina@gmail.com What is typedef
  18. 18. Ä ^{ typedef typedef† define « O † ;.A^ typedef typedef •; ì á5 A:¯K typedef † typedef† const (Š «O typedef†define • O“èŒ ½5 åO¶§ typedef ´^5½Â~þquot;¤± def ine ´{ü iÎG def ine O“§vk?Û a.u õUquot; ïÆæ^ typedef 5½Âa.Ú P•(² ^ const 5½Â~þ ^ def ine 5½Âý?ÈÞI£Î &^ def ine ½Â÷ yankchina@gmail.com What is typedef
  19. 19. Ä ^{ typedef typedef† define « O † ;.A^ typedef typedef •; ì á5 A:¯K typedef † typedef† const (Š «O typedef†define • O“èŒ ½5 åO¶§ typedef ´^5½Â~þquot;¤± def ine ´{ü iÎG def ine O“§vk?Û a.u õUquot; ïÆæ^ typedef 5½Âa.Ú P•(² ^ const 5½Â~þ ^ def ine 5½Âý?ÈÞI£Î &^ def ine ½Â÷ yankchina@gmail.com What is typedef
  20. 20. Ä ^{ typedef typedef† define « O † ;.A^ typedef typedef •; ì á5 A:¯K typedef † typedef† const (Š «O typedef†define • O“èŒ ½5 åO¶§ typedef ´^5½Â~þquot;¤± def ine ´{ü iÎG def ine O“§vk?Û a.u õUquot; ïÆæ^ typedef 5½Âa.Ú P•(² ^ const 5½Â~þ ^ def ine 5½Âý?ÈÞI£Î &^ def ine ½Â÷ yankchina@gmail.com What is typedef
  21. 21. Ä ^{ typedef typedef† define « O † ;.A^ typedef typedef •; ì á5 A:¯K typedef † typedef† const (Š «O typedef†define • O“èŒ ½5 åO¶§ typedef ´^5½Â~þquot;¤± def ine ´{ü iÎG def ine O“§vk?Û a.u õUquot; ïÆæ^ typedef 5½Âa.Ú P•(² ^ const 5½Â~þ ^ def ine 5½Âý?ÈÞI£Î &^ def ine ½Â÷ yankchina@gmail.com What is typedef
  22. 22. Ä ^{ typedef typedef† define « O † ;.A^ typedef typedef •; ì á5 A:¯K typedef † typedef† const (Š ̇SN typedef Ä ^{ 1 Ξ C Šó {z a. O¶ ½Â² Ã'a. {zE,(² typedef ;.A^ 2 ª² a.½Â £N¼ê typedef A:¯K 3 typedef†define «O typedef •;ìá5 typedef†const (Š 4 yankchina@gmail.com What is typedef
  23. 23. Ä ^{ typedef typedef† define « O † ;.A^ typedef typedef •; ì á5 A:¯K typedef † typedef† const (Š typedef •;ìá5 typedef ´˜‡•;ìa'…i§ ÙØU † auto, extern, mutable, static, register é^quot;ù¿Ø´ ` typedef ¬ý K•é– •;A5¶ ´3Šé ¤ þ§ typedef (²wå5– static, extern a. Cþ(²quot; t y p e d e f r e g i s t e r i n t FAST COUNTER ; // e r r o r yankchina@gmail.com What is typedef
  24. 24. Ä ^{ typedef typedef† define « O † ;.A^ typedef typedef •; ì á5 A:¯K typedef † typedef† const (Š ̇SN typedef Ä ^{ 1 Ξ C Šó {z a. O¶ ½Â² Ã'a. {zE,(² typedef ;.A^ 2 ª² a.½Â £N¼ê typedef A:¯K 3 typedef†define «O typedef •;ìá5 typedef†const (Š 4 yankchina@gmail.com What is typedef
  25. 25. Ä ^{ typedef typedef† define « O † ;.A^ typedef typedef •; ì á5 A:¯K typedef † typedef† const (Š typedef†const typedef ´½Â ˜«a. #O¶§ ØÓu÷§Ø´ {ü iÎGO†quot; Ù3u const '…iÓžÑyž§ØU{ ü/?1iÎGO†§ ‡c[©ÛÙa.'équot; t y p e d e f c h a r ∗ PSTR ; i n t mystrcmp ( c o n s t PSTR , c o n s t PSTR ) ; ùp const P ST R ƒ u const char∗ „ ´ char ∗ const quot; yankchina@gmail.com What is typedef
  26. 26. Ä ^{ typedef ;.A^ typedef A:¯K typedef (Š ïÄ C++ Š{§•UN› rŒ†`{quot; C++ yankchina@gmail.com What is typedef

×