| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> c/c++ >> C/C++ bian cheng xin shou cuo wu yu lu
 

C/C++ bian cheng xin shou cuo wu yu lu

2008-06-01 02:04:59 编辑來源:互联网 评论
 
本文为【C/C++编程新手错误语录】的拼音翻译版
  1. yin yan
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  huan ji de dang nian xue shu xue 、 ying yu dou you ge qiao men , na jiu shi gao ge cuo ti ji 。 jing chang fu xi yi xia zhe ge cuo ti ji , jiu ke yi bi mian xia ci fan tong yang de cuo wu 。 er ji hu suo you de cheng xu yuan dou shi cong fan cuo wu kai shi de , wo men ye hen you bi yao zong jie yi xia bian cheng xin shou de chang jian cuo wu , ben wen de mu de zai yu ci 。 wen zhong suo lie chu de dou shi bi zhe zai xiang mu kai fa zhong jie chu dao de xin shou zhen shi de yan tan , bi zhe xue xue wen ge qiang tiao , gu qie cheng zhi wei “ cuo wu yu lu ”。
  2. yu lu
  (1)“ wo de cheng xu dou shi dui de , ke jie guo bu dui ”
  xiang xiang ni de si zhou , shi bu shi ye you ren shuo zhe yang de hua ? jia ru ni ye zeng jing shuo guo , na jiu ci da zhu , bu yao zai shuo zhe ju hua , yin wei zhe ju hua zhi hui xian shi shuo hua zhe de wu zhi 。 ji ran cheng xu dou shi dui de , na wei shen me jie guo bu dui ?
  (2)“ cheng xu = suan fa + shu ju jie gou ”
  jia ru gang gang xue wan C yu yan , wo men shuo zhe yang de hua , wan quan ke yi li jie , er qie ke yi shuo shi zheng que de 。 dan shi jia ru ni shi yi wei ji jiang cong shi C/C++ bian cheng de cheng xu yuan , na me hen yi han , zhe ge shuo fa zhi neng pan cuo , shu bu zhi , shi jie shang huan you ling yi zhong shuo fa :
  cheng xu = dui xiang + xiao xi
  “ cheng xu = suan fa + shu ju jie gou ” zhi dui mian xiang guo cheng de yu yan (C) cheng li , er dui mian xiang dui xiang de yu yan (C++), ze zhi neng biao shu wei “ cheng xu = dui xiang + xiao xi ”。 chuan tong de guo cheng shi bian cheng yu yan yi guo cheng wei zhong xin yi suan fa wei qu dong , mian xiang dui xiang de bian cheng yu yan ze yi dui xiang wei zhong xin yi xiao xi wei qu dong 。 zhe li de xiao xi shi guang yi de , dui xiang A tiao yong le dui xiang B de cheng yuan han shu , ke kan zuo dui xiang A gei B fa xiao xi 。
  (3)“ cheng xu bian chu lai , yun xing zheng que jiu xing le ”
  yun xing zheng que de cheng xu bing bu yi ding shi hao cheng xu , cheng xu yuan shi ke yao lao ji de yi tiao jiu shi zi ji xie de cheng xu bu jin shi gei zi ji kan de , yao rang bie ren ye neng qing yi di kan dong 。 hen yi han , xu duo de bian cheng xin shou bu neng qing chu di jia yu ruan jian de jie gou , dui tou wen jian he shi xian wen jian de gai nian han hu bu qing , xie chu lai de cheng xu ke du xing hen cha 。
  C cheng xu cai yong mo kuai hua de bian cheng si xiang , xu he li di jiang yi ge hen da de ruan jian hua fen wei yi xi lie gong neng du li de bu fen he zuo wan cheng xi tong de xu qiu , zai mo kuai de hua fen shang zhu yao yi ju gong neng 。 mo kuai you tou wen jian he shi xian wen jian zu cheng , dui tou wen jian he shi xian wen jian de zheng que shi yong fang fa shi :
  gui ze 1 tou wen jian (.h) zhong shi dui yu gai mo kuai jie kou de sheng ming , jie kou bao kuo gai mo kuai ti gong gei qi ta mo kuai tiao yong de wai bu han shu ji wai bu quan ju bian liang , dui zhe xie bian liang he han shu dou xu zai .h zhong wen jian zhong guan yi extern yao hai zi sheng ming ;
  gui ze 2 mo kuai nei de han shu he quan ju bian liang xu zai .c wen jian kai tou guan yi static yao hai zi sheng ming ;
  gui ze 3 yong yuan bu yao zai .h wen jian zhong ding yi bian liang ;
  xu duo cheng xu yuan dui ding yi bian liang he sheng ming bian liang hun xiao bu qing , ding yi bian liang he sheng ming bian liang de qu bie zai yu ding yi hui chan sheng nei cun fen pei de cao zuo , shi hui bian jie duan de gai nian ; er sheng ming ze zhi shi gao su bao han gai sheng ming de mo kuai zai lian jie jie duan cong qi ta mo kuai xun zhao wai bu han shu he bian liang 。 ru :
  /* mo kuai 1 tou wen jian :module1.h*/
  int a = 5; /* zai mo kuai 1 de .h wen jian zhong ding yi int a */
  /* mo kuai 1 shi xian wen jian :module1 .c*/
  #include “module1.h” /* zai mo kuai 1 zhong bao han mo kuai 1 de .h wen jian */
  /* mo kuai 2 shi xian wen jian : module2.c*/
  #include “module1.h” /* zai mo kuai 2 zhong bao han mo kuai 1 de .h wen jian */
  /* mo kuai 2 shi xian wen jian :module3 .c*/
  #include “module1.h” /* zai mo kuai 3 zhong bao han mo kuai 1 de .h wen jian */
  yi shang cheng xu de jie guo shi zai mo kuai 1、2、3 zhong dou ding yi le zheng xing bian liang a,a zai bu tong de mo kuai zhong dui ying bu tong de di zhi dan yuan , zhe ming xian bu fu he bian xie zhe de ben yi 。 zheng que de zuo fa shi :
  /* mo kuai 1 tou wen jian :module1.h*/
  extern int a; /* zai mo kuai 1 de .h wen jian zhong sheng ming int a */
  /* mo kuai 1 shi xian wen jian :module1 .c*/
  #include “module1.h” /* zai mo kuai 1 zhong bao han mo kuai 1 de .h wen jian */
  int a = 5; /* zai mo kuai 1 de .c wen jian zhong ding yi int a */
  /* mo kuai 2 shi xian wen jian : module2 .c*/
  #include “module1.h” /* zai mo kuai 2 zhong bao han mo kuai 1 de .h wen jian */
  /* mo kuai 3 shi xian wen jian : module3 .c*/
  #include “module1.h” /* zai mo kuai 3 zhong bao han mo kuai 1 de .h wen jian */
  zhe yang jia ru mo kuai 1、2、3 cao zuo a de hua , dui ying de shi tong yi pian nei cun dan yuan 。
  
C/C++编程新手错误语录
geng duo nei rong qing kan C/C++ ji shu zhuan ti java bian cheng kai fa shou ce zhuan ti , huo
  gui ze 4 jia ru yao yong qi ta mo kuai ding yi de bian liang he han shu , zhi jie bao han qi tou wen jian ji ke 。
  xu duo cheng xu yuan xi huan zhe yang zuo , dang ta men yao fang wen qi ta mo kuai ding yi de bian liang shi , ta men zai ben mo kuai wen jian kai tou tian jia zhe yang de yu ju :
  extern int externVar;
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
   pao qi zhe zhong zuo fa ba , zhi yao tou wen jian an gui ze 1 wan cheng , mou mo kuai yao fang wen qi ta mo kuai zhong ding yi de quan ju bian liang shi , zhi yao bao han gai mo kuai de tou wen jian ji ke 。
  (4)“ shu zu ming jiu shi zhi zhen ”
  xu duo cheng xu yuan dui shu zu ming he zhi zhen de qu bie bu shen ming le , ta men ren wei shu zu ming jiu shi zhi zhen , er shi ji shang shu zu ming he zhi zhen you hen da qu bie , zai shi yong shi yao jin xing zheng que qu fen , qi qu fen gui ze ru xia :
  gui ze 1 shu zu ming zhi dai yi zhong shu ju jie gou , zhe zhong shu ju jie gou jiu shi shu zu ;
  li ru :
  char str[10];
  char *pStr = str;
  cout << sizeof(str) << endl;
  cout << sizeof(pStr) << endl;
  shu chu jie guo wei :
  10
  4
  zhe shuo ming shu zu ming str zhi dai shu ju jie gou char[10]。
  gui ze 2 shu zu ming ke yi zhuan huan wei zhi xiang qi zhi dai shi ti de zhi zhen , er qie shi yi ge zhi zhen chang liang , bu neng zuo zi zeng 、 zi jian deng cao zuo , bu neng bei xiu gai ;
  char str[10];
  char *pStr = str;
  str++; // bian yi chu cuo , ti shi str bu shi zuo zhi
  pStr++; // bian yi zheng que
  gui ze 3 zhi xiang shu zu de zhi zhen ze shi ling wai yi zhong bian liang lei xing ( zai WIN32 ping tai xia , chang du wei 4), jin jin yi wei zhe shu zu de cun fang di zhi ;
  gui ze 4 shu zu ming zuo wei han shu xing shen shi , zai han shu ti nei , qi shi qu le ben shen de nei han , jin jin zhi shi yi ge zhi zhen ; hen yi han , zai shi qu qi nei han de tong shi , ta huan shi qu le qi chang liang te xing , ke yi zuo zi zeng 、 zi jian deng cao zuo , ke yi bei xiu gai 。
  li ru :
  void arrayTest(char str[])
  {
  cout << sizeof(str) << endl;// shu chu zhi zhen chang du
  str++; // bian yi zheng que
  }
  int main(int argc, char* argv[])
  {
  char str1[10] = "I Love U";
  arrayTest(str1);
  return 0;
  }
  (5)“ zheng xing bian liang wei 32 wei ”
  zheng xing bian liang shi bu shi 32 wei zhe ge wen ti bu jin yu ju ti de CPU jia gou you guan , er qie yu bian yi qi you guan 。 zai qian ru shi xi tong de bian cheng zhong , yi ban zheng shu de wei shu deng yu CPU zi chang , chang yong de qian ru shi CPU xin pian de zi chang wei 8、16、32, yin er zheng xing bian liang de chang du ke neng shi 8、16、32。 zai wei lai 64 wei ping tai xia , zheng xing bian liang de chang du ke da dao 64 wei 。
  chang zheng xing bian liang de chang du yi ban wei CPU zi chang de 2 bei 。
  zai shu ju jie gou de she ji zhong , you xiu de cheng xu yuan bing bu hui zhe yang ding yi shu ju jie gou ( jia she wei WIN32 ping tai ):
  typedef strUCt tagTypeExample
  {
  unsigned short x;
  unsigned int y;
  }TypeExample;
  ta men zhe yang ding yi :
  #define unsigned short UINT16 //16 wei wu fu hao zheng shu
  #define unsigned int UINT32 //32 wei wu fu hao zheng shu
  typedef struct tagTypeExample
  {
  UINT16 x;
  UINT32 y;
  }TypeExample;
C/C++编程新手错误语录
geng duo nei rong qing kan C/C++ ji shu zhuan ti Java bian cheng kai fa shou ce zhuan ti , huo
  zhe yang ding yi de shu ju jie gou fei chang ju you tong yong xing , jia ru shang shu 32 ping tai shang de shu ju fa song dao 16 wei ping tai shang jie shou , zai 16 wei ping tai shang jin jin xu yao xiu gai UINT16、UINT32 de ding yi :
  #define unsigned int UINT16 //16 wei wu fu hao zheng shu
  #define unsigned long UINT32 //32 wei wu fu hao zheng shu
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  ji hu suo you de you xiu ruan jian she ji wen dang dou shi zhe yang ding yi shu ju jie gou de 。
  (6)“switch he if …else… ke sui yi ti huan ”
  switch yu ju he yi dui if…else… de zu he sui ran gong neng shang wan quan yi yang , dan shi gei du zhe de gan shou wan quan bu yi yang 。if…else… de gan jiao shi jin xing tiao jian pan ding , dui te li jin xing fei fan chu li , zai luo ji shang shi “ fei fan yu yi ban ” de guan xi , er switch gei ren de gan jiao shi duo ge tiao jian de guan xi shi bing lie de , shi wu zhi jian bu cun zai fei fan yu yi ban de guan xi , wan quan “ dui deng ”。
  pi ru :
  // fen bie dui 1-10 de shu zi jin xing bu tong de chu li , yong switch
  switch(num)
  {
  case 1:
  …
  case 2:
  …
  }
  // dui 1-10 zhi jian de shu zi jin xing fei fan chu li , yong if
  if(num < 10 && num > 1)
  {
  …
  }
  else
  {
  …
  }
  xu duo shi hou , sui ran bu tong de dai ma ke shi xian wan quan xiang tong de gong neng , dan shi gei du zhe de gan jiao shi wan quan bu tong de 。 pi ru wu tiao jian xun huan :
  while(1)
  {
  }
  you de cheng xu yuan zhe yang xie :
  for(;;)
  {
  }
  zhe ge yu fa mei you que qie biao da dai ma de han yi , wo men cong for(;;) kan bu chu shen me , zhi you nong ming bai for(;;) zai C/C++ yu yan zhong yi wei zhe wu tiao jian xun huan cai ming bai qi yi 。 er bu dong C/C++ yu yan de du zhe kan dao while(1) ye ke cai dao zhe shi yi ge wu tiao jian xun huan 。
  (7)“ mian de ma fan , ba lei li mian de cheng yuan han shu dou gao cheng public suan le ”
  
   xu duo ren bian C++ cheng xu de shi hou , dou peng dao zhe yang de qing kuang , xian qian ba mou ge cheng yuan han shu ding yi cheng lei de PRivate/protected han shu , hou lai fa xian you yao cong wai mian tiao yong zhe ge han shu , jiu qing yi di jiang cheng yuan han shu gai wei public lei xing de 。 shen zhi xu duo cheng xu yuan wei le bi mian fang wen de ma fan , gan cui ba zi ji tian jia de cheng yuan han shu he cheng yuan bian liang dou ding yi cheng public lei xing 。
  shu bu zhi , zhe shi yi zhong gui hua de shi bai 。 zai lei de she ji jie duan , wo men jiu yao hen qing chu di zhi dao , zhe ge lei de cheng yuan han shu zhong na xie shi zhe ge lei de jie kou , na xie shu yu zhe ge lei nei bu de cheng yuan han shu he bian liang 。 yi ban de zhun ze shi jie kou (public cheng yuan ) ying zai man zu xu qiu de qian ti xia jin ke neng jian dan !
  suo yi bu yao qing yi di jiang private/protected cheng yuan gai wei public cheng yuan , zhen zheng de gong zuo ying gai zai gui hua jie duan wan cheng 。
  3. jie shu yu
  suo you de cheng xu yuan dou yao jing li yi ge cong hu tu dao qing chu de guo cheng , wen zhong de cuo wu jia ru ni ye fan le , qie wu zi can 。 geng duo de cuo wu yu lu , xi wang neng zai hou xu wen zhang zhong lu xu tui chu 。
C/C++编程新手错误语录
geng duo nei rong qing kan C/C++ ji shu zhuan ti Java bian cheng kai fa shou ce zhuan ti , huo【原文】【汉音对照
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
     1. yin yan    huan ji de dang nian xue shu xue 、 ying yu dou you ge qiao men , na jiu shi gao ge cuo ti ji 。 jing chang fu xi yi xia zhe ge cuo ti ji , jiu ke yi bi mian xia ci fan tong yang de cuo wu 。 er ji hu suo you de cheng xu yuan dou shi cong fan cuo wu kai shi de , wo men ye hen you bi yao zong jie yi xia bian cheng xin shou de chang jian cuo wu , ben wen de mu de zai yu ci 。 wen zhong suo lie chu de dou shi bi zhe zai xiang mu kai fa zhong jie chu dao de xin shou zhen shi de yan tan , bi zhe xue xue wen ge qiang tiao , gu qie cheng zhi wei “ cuo wu yu lu ”。 2. yu lu (1)“ wo de cheng xu dou shi dui de , ke jie guo bu dui ”    xiang xiang ni de si zhou , shi bu shi ye you ren shuo zhe yang de hua ? jia ru ni ye zeng jing shuo guo , na jiu ci da zhu , bu yao zai shuo zhe ju hua , yin wei zhe ju hua zhi hui xian shi shuo hua zhe de wu zhi 。 ji ran cheng xu dou shi dui de , na wei shen me jie guo bu dui ? (2)“ cheng xu = suan fa + shu ju jie gou ”    jia ru gang gang xue wan C yu yan , wo men shuo zhe yang de hua , wan quan ke yi li jie , er qie ke yi shuo shi zheng que de 。 dan shi jia ru ni shi yi wei ji jiang cong shi C/C++ bian cheng de cheng xu yuan , na me hen yi han , zhe ge shuo fa zhi neng pan cuo , shu bu zhi , shi jie shang huan you ling yi zhong shuo fa :    cheng xu = dui xiang  + xiao xi  “ cheng xu = suan fa + shu ju jie gou ” zhi dui mian xiang guo cheng de yu yan (C) cheng li , er dui mian xiang dui xiang de yu yan (C++), ze zhi neng biao shu wei “ cheng xu = dui xiang + xiao xi ”。 chuan tong de guo cheng shi bian cheng yu yan yi guo cheng wei zhong xin yi suan fa wei qu dong , mian xiang dui xiang de bian cheng yu yan ze yi dui xiang wei zhong xin yi xiao xi wei qu dong 。 zhe li de xiao xi shi guang yi de , dui xiang A tiao yong le dui xiang B de cheng yuan han shu , ke kan zuo dui xiang A gei B fa xiao xi 。 (3)“ cheng xu bian chu lai , yun xing zheng que jiu xing le ”    yun xing zheng que de cheng xu bing bu yi ding shi hao cheng xu , cheng xu yuan shi ke yao lao ji de yi tiao jiu shi zi ji xie de cheng xu bu jin shi gei zi ji kan de , yao rang bie ren ye neng qing yi di kan dong 。 hen yi han , xu duo de bian cheng xin shou bu neng qing chu di jia yu ruan jian de jie gou , dui tou wen jian he shi xian wen jian de gai nian han hu bu qing , xie chu lai de cheng xu ke du xing hen cha 。   C cheng xu cai yong mo kuai hua de bian cheng si xiang , xu he li di jiang yi ge hen da de ruan jian hua fen wei yi xi lie gong neng du li de bu fen he zuo wan cheng xi tong de xu qiu , zai mo kuai de hua fen shang zhu yao yi ju gong neng 。 mo kuai you tou wen jian he shi xian wen jian zu cheng , dui tou wen jian he shi xian wen jian de zheng que shi yong fang fa shi :    gui ze 1  tou wen jian (.h) zhong shi dui yu gai mo kuai jie kou de sheng ming , jie kou bao kuo gai mo kuai ti gong gei qi ta mo kuai tiao yong de wai bu han shu ji wai bu quan ju bian liang , dui zhe xie bian liang he han shu dou xu zai .h zhong wen jian zhong guan yi extern yao hai zi sheng ming ;    gui ze 2 mo kuai nei de han shu he quan ju bian liang xu zai .c wen jian kai tou guan yi static yao hai zi sheng ming ;    gui ze 3 yong yuan bu yao zai .h wen jian zhong ding yi bian liang ;    xu duo cheng xu yuan dui ding yi bian liang he sheng ming bian liang hun xiao bu qing , ding yi bian liang he sheng ming bian liang de qu bie zai yu ding yi hui chan sheng nei cun fen pei de cao zuo , shi hui bian jie duan de gai nian ; er sheng ming ze zhi shi gao su bao han gai sheng ming de mo kuai zai lian jie jie duan cong qi ta mo kuai xun zhao wai bu han shu he bian liang 。 ru : /* mo kuai 1 tou wen jian :module1.h*/ int a = 5; /* zai mo kuai 1 de .h wen jian zhong ding yi int a */ /* mo kuai 1 shi xian wen jian :module1 .c*/ #include “module1.h” /* zai mo kuai 1 zhong bao han mo kuai 1 de .h wen jian */ /* mo kuai 2 shi xian wen jian : module2.c*/ #include “module1.h” /* zai mo kuai 2 zhong bao han mo kuai 1 de .h wen jian */ /* mo kuai 2 shi xian wen jian :module3 .c*/ #include “module1.h” /* zai mo kuai 3 zhong bao han mo kuai 1 de .h wen jian */ yi shang cheng xu de jie guo shi zai mo kuai 1、2、3 zhong dou ding yi le zheng xing bian liang a,a zai bu tong de mo kuai zhong dui ying bu tong de di zhi dan yuan , zhe ming xian bu fu he bian xie zhe de ben yi 。 zheng que de zuo fa shi : /* mo kuai 1 tou wen jian :module1.h*/ extern int a; /* zai mo kuai 1 de .h wen jian zhong sheng ming int a */ /* mo kuai 1 shi xian wen jian :module1 .c*/ #include “module1.h” /* zai mo kuai 1 zhong bao han mo kuai 1 de .h wen jian */ int a = 5; /* zai mo kuai 1 de .c wen jian zhong ding yi int a */ /* mo kuai 2 shi xian wen jian : module2 .c*/ #include “module1.h” /* zai mo kuai 2 zhong bao han mo kuai 1 de .h wen jian */ /* mo kuai 3 shi xian wen jian : module3 .c*/ #include “module1.h”   /* zai mo kuai 3 zhong bao han mo kuai 1 de .h wen jian */    zhe yang jia ru mo kuai 1、2、3 cao zuo a de hua , dui ying de shi tong yi pian nei cun dan yuan 。 [url=http://www.wangchao.net.cn/bbs/pydetail_1785330.html][img]http://image.wangchao.net.cn/it/1323423858200.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti java bian cheng kai fa shou ce zhuan ti , huo    gui ze 4 jia ru yao yong qi ta mo kuai ding yi de bian liang he han shu , zhi jie bao han qi tou wen jian ji ke 。 xu duo cheng xu yuan xi huan zhe yang zuo , dang ta men yao fang wen qi ta mo kuai ding yi de bian liang shi , ta men zai ben mo kuai wen jian kai tou tian jia zhe yang de yu ju : extern int externVar;     pao qi zhe zhong zuo fa ba , zhi yao tou wen jian an gui ze 1 wan cheng , mou mo kuai yao fang wen qi ta mo kuai zhong ding yi de quan ju bian liang shi , zhi yao bao han gai mo kuai de tou wen jian ji ke 。 (4)“ shu zu ming jiu shi zhi zhen ”    xu duo cheng xu yuan dui shu zu ming he zhi zhen de qu bie bu shen ming le , ta men ren wei shu zu ming jiu shi zhi zhen , er shi ji shang shu zu ming he zhi zhen you hen da qu bie , zai shi yong shi yao jin xing zheng que qu fen , qi qu fen gui ze ru xia :    gui ze 1  shu zu ming zhi dai yi zhong shu ju jie gou , zhe zhong shu ju jie gou jiu shi shu zu ;    li ru : char str[10]; char *pStr = str; cout << sizeof(str) << endl; cout << sizeof(pStr) << endl;    shu chu jie guo wei :  10 4    zhe shuo ming shu zu ming str zhi dai shu ju jie gou char[10]。    gui ze 2  shu zu ming ke yi zhuan huan wei zhi xiang qi zhi dai shi ti de zhi zhen , er qie shi yi ge zhi zhen chang liang , bu neng zuo zi zeng 、 zi jian deng cao zuo , bu neng bei xiu gai ; char str[10]; char *pStr = str; str++; // bian yi chu cuo , ti shi str bu shi zuo zhi   pStr++; // bian yi zheng que    gui ze 3  zhi xiang shu zu de zhi zhen ze shi ling wai yi zhong bian liang lei xing ( zai WIN32 ping tai xia , chang du wei 4), jin jin yi wei zhe shu zu de cun fang di zhi ;    gui ze 4  shu zu ming zuo wei han shu xing shen shi , zai han shu ti nei , qi shi qu le ben shen de nei han , jin jin zhi shi yi ge zhi zhen ; hen yi han , zai shi qu qi nei han de tong shi , ta huan shi qu le qi chang liang te xing , ke yi zuo zi zeng 、 zi jian deng cao zuo , ke yi bei xiu gai 。 li ru : void arrayTest(char str[]) { cout << sizeof(str) << endl;   // shu chu zhi zhen chang du     str++; // bian yi zheng que } int main(int argc, char* argv[]) {  char str1[10] = "I Love U";  arrayTest(str1); return 0; } (5)“ zheng xing bian liang wei 32 wei ”    zheng xing bian liang shi bu shi 32 wei zhe ge wen ti bu jin yu ju ti de CPU jia gou you guan , er qie yu bian yi qi you guan 。 zai qian ru shi xi tong de bian cheng zhong , yi ban zheng shu de wei shu deng yu CPU zi chang , chang yong de qian ru shi CPU xin pian de zi chang wei 8、16、32, yin er zheng xing bian liang de chang du ke neng shi 8、16、32。 zai wei lai 64 wei ping tai xia , zheng xing bian liang de chang du ke da dao 64 wei 。    chang zheng xing bian liang de chang du yi ban wei CPU zi chang de 2 bei 。    zai shu ju jie gou de she ji zhong , you xiu de cheng xu yuan bing bu hui zhe yang ding yi shu ju jie gou ( jia she wei WIN32 ping tai ): typedef strUCt tagTypeExample { unsigned short x; unsigned int y; }TypeExample; ta men zhe yang ding yi : #define unsigned short UINT16 //16 wei wu fu hao zheng shu #define unsigned int UINT32 //32 wei wu fu hao zheng shu typedef struct tagTypeExample { UINT16 x; UINT32 y; }TypeExample; [url=http://www.wangchao.net.cn/bbs/pydetail_1785330.html][img]http://image.wangchao.net.cn/it/1323423858239.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti Java bian cheng kai fa shou ce zhuan ti , huo    zhe yang ding yi de shu ju jie gou fei chang ju you tong yong xing , jia ru shang shu 32 ping tai shang de shu ju fa song dao 16 wei ping tai shang jie shou , zai 16 wei ping tai shang jin jin xu yao xiu gai UINT16、UINT32 de ding yi : #define unsigned int UINT16 //16 wei wu fu hao zheng shu #define unsigned long UINT32 //32 wei wu fu hao zheng shu    ji hu suo you de you xiu ruan jian she ji wen dang dou shi zhe yang ding yi shu ju jie gou de 。 (6)“switch he if …else… ke sui yi ti huan ”   switch yu ju he yi dui if…else… de zu he sui ran gong neng shang wan quan yi yang , dan shi gei du zhe de gan shou wan quan bu yi yang 。if…else… de gan jiao shi jin xing tiao jian pan ding , dui te li jin xing fei fan chu li , zai luo ji shang shi “ fei fan yu yi ban ” de guan xi , er switch gei ren de gan jiao shi duo ge tiao jian de guan xi shi bing lie de , shi wu zhi jian bu cun zai fei fan yu yi ban de guan xi , wan quan “ dui deng ”。 pi ru : // fen bie dui 1-10 de shu zi jin xing bu tong de chu li , yong switch switch(num) { case 1: … case 2: … } // dui 1-10 zhi jian de shu zi jin xing fei fan chu li , yong if if(num < 10 && num > 1) { … } else { … }    xu duo shi hou , sui ran bu tong de dai ma ke shi xian wan quan xiang tong de gong neng , dan shi gei du zhe de gan jiao shi wan quan bu tong de 。 pi ru wu tiao jian xun huan : while(1) { }    you de cheng xu yuan zhe yang xie : for(;;) { }    zhe ge yu fa mei you que qie biao da dai ma de han yi , wo men cong for(;;) kan bu chu shen me , zhi you nong ming bai for(;;) zai C/C++ yu yan zhong yi wei zhe wu tiao jian xun huan cai ming bai qi yi 。 er bu dong C/C++ yu yan de du zhe kan dao while(1) ye ke cai dao zhe shi yi ge wu tiao jian xun huan 。 (7)“ mian de ma fan , ba lei li mian de cheng yuan han shu dou gao cheng public suan le ”    xu duo ren bian C++ cheng xu de shi hou , dou peng dao zhe yang de qing kuang , xian qian ba mou ge cheng yuan han shu ding yi cheng lei de PRivate/protected han shu , hou lai fa xian you yao cong wai mian tiao yong zhe ge han shu , jiu qing yi di jiang cheng yuan han shu gai wei public lei xing de 。 shen zhi xu duo cheng xu yuan wei le bi mian fang wen de ma fan , gan cui ba zi ji tian jia de cheng yuan han shu he cheng yuan bian liang dou ding yi cheng public lei xing 。    shu bu zhi , zhe shi yi zhong gui hua de shi bai 。 zai lei de she ji jie duan , wo men jiu yao hen qing chu di zhi dao , zhe ge lei de cheng yuan han shu zhong na xie shi zhe ge lei de jie kou , na xie shu yu zhe ge lei nei bu de cheng yuan han shu he bian liang 。 yi ban de zhun ze shi jie kou (public cheng yuan ) ying zai man zu xu qiu de qian ti xia jin ke neng jian dan !    suo yi bu yao qing yi di jiang private/protected cheng yuan gai wei public cheng yuan , zhen zheng de gong zuo ying gai zai gui hua jie duan wan cheng 。 3. jie shu yu    suo you de cheng xu yuan dou yao jing li yi ge cong hu tu dao qing chu de guo cheng , wen zhong de cuo wu jia ru ni ye fan le , qie wu zi can 。   geng duo de cuo wu yu lu , xi wang neng zai hou xu wen zhang zhong lu xu tui chu 。 [url=http://www.wangchao.net.cn/bbs/pydetail_1785330.html][img]http://image.wangchao.net.cn/it/1323423858253.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti Java bian cheng kai fa shou ce zhuan ti , huo
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
时尚性感的燕子(3)
时尚性感的燕子(2)
纯美的女生生活写真(14)
纯美的女生生活写真(13)
来自束河[]
恰巧-巧家~~
高尔夫
行摄匆匆天子山
 
>>返回首页<<
 为你推荐
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
©2005- 王朝网络 版权所有