Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¿¼²éǶÈëʽC¿ª·¢ÈËÔ±×îºÃµÄÊ®µÀÌâ²Î¿¼´ð°¸

Ïêϸ²Î¿¼´ð°¸
µÚ1Ìâ:   (b)
volatile×ÖÃæÒâ˼ÊÇÒ×ÓÚ»Ó·¢µÄ¡£Õâ¸ö¹Ø¼ü×ÖÀ´ÃèÊöÒ»¸ö±äÁ¿Ê±£¬Òâζ×Å ¸ø¸Ã±äÁ¿¸³Öµ(дÈë)Ö®ºó£¬ÂíÉÏÔÙ¶ÁÈ¡£¬Ð´ÈëµÄÖµÓë¶ÁÈ¡µÄÖµ¿ÉÄܲ»Ò»Ñù,ËùÒÔ˵Ëü"ÈÝÒ×»Ó·¢"µÄ¡£
ÕâÊÇÒòΪÕâ¸ö±äÁ¿¿ÉÄÜÒ»¸ö¼Ä´æÆ÷£¬Ö±½ÓÓëÍⲿÉ豸ÏàÁ¬£¬ÄãдÈëÖ®ºó£¬¸Ã¼Ä´æÆ÷Ò²ÓпÉÄܱ»ÍⲿÉ豸µÄд²Ù×÷Ëù¸Ä±ä;»òÕߣ¬¸Ã±äÁ¿±»Ò»¸öÖжϳÌÐò£¬»òÁíÒ»¸ö½ø³Ì
¸Ä±äÁË.
volatile ²»»á±»±àÒëÆ÷ÓÅ»¯Ó°Ï죬ÔÚlongjump ºó,ËüµÄÖµ ÊǺóÃæ¼Ù¶¨µÄ±äÁ¿Öµ,b×îºóµÄÖµÊÇ5,ËùÒÔ5±»´òÓ¡³öÀ´.
setjmp : ÉèÖ÷Ǿֲ¿Ìøת /* setjmp.h*/
Stores context information such as register values so that the lomgjmp function can return control to the statement following the one calling setjmp.Returns 0 when it is initially called.
Lonjjmp: Ö´ÐÐÒ»¸ö·Ç¾Ö²¿Ìøת /* setjmp.h*/
Transfers control to the statement where the call to setjmp (which initialized buf) was made. Execution continues at this point as if longjmp cannot return the value 0.A nonvolatile automatic variable might be changed by a call to longjmp.When you use setjmp and longjmp, the only automatic variables guaranteed to remain valid are those declared volatile.
Note: Test program without volatile qualifier (result may very)
¸üÏêϸ½éÉÜ£¬Çë²ÎÔÄ CÓïÑÔµÄsetjmpºÍlongjmp
µÚ2Ìâ:   (a)
½á¹¹ÌâµÄ³ÉÔ±ÔÚÄÚ´æÖеĵØÖ·ÊÇ°´ÕÕËûÃǶ¨ÒåµÄλÖÃ˳ÐòÒÀ´ÎÔö³¤µÄ¡£Èç¹ûÒ»¸ö½á¹¹ÌåµÄÖ¸Õë±»¿´³É ËüµÄµÚÒ»¸ö³ÉÔ±µÄÖ¸Õë,ÄÇô¸ÃÖ¸ÕëµÄÈ·Ö¸ÏòµÚÒ»¸ö³ÉÔ±
µÚ3Ìâ:  (a)
´ËÌâÄ¿½ÏÄÑ.
Õâ¸ö³ÌÐòµÄ·ÇµÝ¹é°æ±¾
int  what ( int x , int  n)
{
  int val;
  int product;
  product =1;
  val =x;
  while(n>0)
  {
     if (n%2 == 1)
       product = product*val;   /*Èç¹ûÊÇÆæÊý´ÎÃÝ,  x(val)ÒªÏȳËÉÏÒ»´Î,;  żÊý´ÎÃÝ,×îºó·µ»Øʱ²Å»áµ½ÕâÀï³ËÒÔ1*/
     val = val* val;
     n = n/2;
   }
   return product;
}/* ÓöþÔª¸´³Ë²ßÂÔ */
Ëã·¨ÃèÊö
(while n>0)
{
  if  next most significant binary digit of  n( power)&n


Ïà¹ØÎĵµ£º

C/C++Êý×éÃûÓëÖ¸ÕëÇø±ðÉî²ã̽Ë÷

C/C++Êý×éÃûÓëÖ¸ÕëÇø±ðÉî²ã̽Ë÷
 
×÷ÕߣºËᦻª e-mail:21cnbao_AT_21cn.com [AT -> @]
1. ÒýÑÔ
Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à
³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚC ÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º“Êý ......

Linux ²Ù×÷ϵͳ C ÓïÑÔ±à³ÌÈëÃÅ

Linux ²Ù×÷ϵͳ C ÓïÑÔ±à³ÌÈëÃÅ

Ŀ ¼
µÚÒ»Õ »ù´¡ÖªÊ¶ ……………………………………………………………4
µÚ¶þÕÂ ......

C++ÖÐextern ¡°C¡±º¬ÒåÉî²ã̽Ë÷(ת)

1.ÒýÑÔ
¡¡¡¡C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³ÌʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö±äÁ¿ºÍº¯Êý¡£µ«ÊÇ£¬C++±Ï¾ ......

¡¾C\C++ÓïÑÔÈëÃÅƪ¡¿ »ù±¾Êý¾ÝÀàÐÍ

ǰһƪÎÒÃǽéÉÜÁËÒ»¸ö¼òµ¥²»¹ýµÄhelloworld³ÌÐòÒý³öÏà¹ØÎÊÌâ¡£³Ã×Å»¹Ã»ÓÐÍüµôÄÇЩ˼¿¼·½Ê½µÄ¼ÇÒ䣬±¾Æª¼ÌÐøÑÓÐøÕâÖÖ˼ά·½Ê½µÄÀíÄ½éÉÜÒ»ÏÂCC++ÖеĻù±¾Êý¾ÝÀàÐÍ¡£Êý¾ÝÀàÐͲ»Çå³þµÄ»°ÔÚÒÔºóµÄ±à³ÌÖлáÓкܶàÃÕÍźÍÎÊÌâ¡£ÉõÖÁÒ»¸ö³ÌÐòµÄBUGÕÒ°ëÌìҲûÓÐÕÒ³öÀ´Ê±ÎªÊ²Ã´£¬½á¹û²Å·¢ÏÖÊǼӼõÒç³öÁË¡£¸ü¼ÓÑÏÖصĻ¹ÓÐдԽ½ç¡¢¶ÁÔ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ