c,c++ÄÚ´æÔËÐÐʱÉîÈëÑо¿
C/C++ÄÚ´æÓëÔËÐÐʱÉîÈëÑо¿ [×÷ÕßJean.Love]
-----------------------------------------------------------------------------------
(Ò»)ÕûÊý·ûºÅµÄÏÝÚå
(¶þ)¸¡µãÊýµÄ±¾ÖÊ
(Èý)¶ÑÕ»µÄÄÚ´æ¹ÜÀí½á¹¹
(ËÄ)·ûºÅ½âÎö
(Îå)¶ÔÆëºÍ×ÜÏß´íÎó
(Áù)º¯ÊýÖ¸Õë
(Æß)Ð麯ÊýµÄʵÏÖ»úÀí
(°Ë)ÒýÓõÄʵÏÖ»úÀí
(¾Å)ÐéÄâ¼Ì³Ð¶ÔÏóµÄÄÚ´æ½á¹¹
(Ê®)»ìºÏ±à³ÌʱµÄ³õʼ»¯Ë³Ðò
(ʮһ)Êý×éºÍÖ¸ÕëµÄÒìͬ
(Ê®¶þ)constÏÞ¶¨µÄ´«µÝÐÔ
(Ê®Èý)Êý¾ÝÀàÐ͵ÄÏÞ¶¨ÐÔ¼ì²é
(Ê®ËÄ)ʹÓÃSTLʱµÄÀàÐÍÏÞÖÆ
(Ê®Îå)µü´úÆ÷×ÔÉíµÄÀàÐÍ
(Ê®Áù)ÔËÐÐʱµÄÀàÐÍÐÅÏ¢
(Ê®Æß)new/deleteÖØÔØ
(Ê®°Ë)ÈçºÎ¿½±´Ò»¸öÎļþ
(Ò»)ÕûÊý·ûºÅµÄÏÝÚå
x
#include
int main(void){
int x=1;
unsigned int y=2;
int b=x
int b2=(x-y<0);
printf("%d,%d\n",b,b2);
return 0;
}
ËüÊä³öʲôÄØ£¿
1,0
ÁîÈËÕ𾪣¬²»ÊÇÂð£¬x
(1)x
(2)x-yµÄ½á¹û¼ÆËãµÄʱºò£¬·µ»ØÒ»¸ö0xfffffffe£¬Ëü±»µ±³ÉÎÞ·ûºÅÊý×ÖÀí½â²¢ºÍ0±È½Ï£¬ÏÔÈ»<0²»³ÉÁ¢£¬·µ»Ø0¡£
×ܽáһϣ¬ÕûÊýµÄÔËË㣬¼Ó¼õ³ËµÄʱºò£¬¸ù±¾²»¹ÜÊÇ·ñÉùÃ÷ΪÊÇ·ñÓзûºÅ£¬ÔÚ2½øÖÆcpuÉÏÃæµÄ¼ÆËãÊÇÏàͬµÄ£¬µ«ÊDZȽϵÄʱºò(<,>,==)»á¸ù¾ÝÀàÐÍ£¬µ÷Óò»Í¬µÄ±È½ÏÖ¸ÁҲ¾ÍÊÇÒÔ²»Í¬µÄ·½Ê½À´Àí½âÕâ¸ö2½øÖƽá¹û¡£µ±signedºÍunsigned»ìÓõÄʱºò£¬È«²¿×Ô¶¯ÌáÉýΪÎÞ·ûºÅÕûÊý¡£
#include
int main(void){
int i=-2;
unsigned j=1;
if(j+i>1) //ÌáÉýΪÁ½¸öuintÏà¼Ó
printf("sum=%d\n",j+i);//´òÓ¡µÄ½á¹û¸ù¾Ý%dÖƶ¨£¬j+iµÄÄÚ´æÖµÓÀÔ¶²»±ä¡£
return 0;
}
Êä³ö
> ./a.out
sum=-1
ÔÙ¾ÙÒ»¸öÀý×Ó
#include
int main(void){
int i=-4;
unsigned int j=1;
int ii=i+j;
unsigned int jj=i+j;
printf("%d,%ud\n",ii,jj);
if(ii>1){printf("100000");}
if(jj>1){printf("100001");}
return 0;
}
ÓÃgcc -SµÃµ½»ã±à£¬»á·¢ÏÖif(ii>1)ºÍif(jj>1)¶ÔÓ¦Á½¸ö²»Í¬µÄÌøתָÁ
Ïà¹ØÎĵµ£º
̸̸CÓïÑÔµÄmalloc()ºÍfree()
Ò»¡¢malloc()ºÍfree()µÄ»ù±¾¸ÅÄîÒÔ¼°»ù±¾Ó÷¨£º
1¡¢º¯ÊýÔÐͼ°ËµÃ÷£º
void *malloc(long NumBytes)£º¸Ãº¯Êý·ÖÅäÁËNumBytes¸ö×Ö½Ú£¬²¢·µ»ØÁËÖ¸ÏòÕâ¿éÄÚ´æµÄÖ¸Õë¡£Èç¹û·ÖÅäʧ°Ü£¬Ôò·µ»ØÒ»¸ö¿ÕÖ¸Õ루NULL£©¡£
¹ØÓÚ·ÖÅäʧ°ÜµÄÔÒò£¬Ó¦¸ÃÓжàÖÖ£¬±ÈÈç˵¿Õ¼ä²»×ã¾ÍÊÇÒ»ÖÖ¡£
void free(void *Fir ......
0x80000000£¬¼´–2147483648ʱ,¶ÔËüÈ¡¸º»á²úÉúÉÏÒç
VC.NET 7.1 ÌṩµÄÈ¡¾ø¶ÔÖµº¯Êý(abs.cÖÐ)ÈçÏ£º
¡¡¡¡ int __cdecl abs ( int number)
¡¡¡¡ {
¡¡¡¡ return( number>=0 ? number : -number );
¡¡¡¡ }
¡¡¡¡ ´Ëº¯ÊýʵÏֵ÷dz£¼òµ¥£¬Õ§¿´Ö®ÏÂÎÞÈκÎ벡£¬¿ÉÊÇ×Ðϸ×ÁÄ¥×ÁÄ¥ ......
C/C++ÊÇ×îÖ÷ÒªµÄ±à³ÌÓïÑÔ¡£ÕâÀïÁгöÁË50ÃûÓÅÐãÍøÕ¾ºÍÍøÒ³Çåµ¥£¬ÕâЩÍøÕ¾Ìṩc/c++Ô´´úÂë¡£Õâ·ÝÇåµ¥ÌṩÁËÔ´´úÂëµÄÁ´½ÓÒÔ¼°ËüÃǵÄС˵Ã÷¡£ÎÒÒÑ ¾¡Á¦°üÀ¨×î¼ÑµÄC/C++Ô´´úÂëµÄÍøÕ¾¡£Õâ²»ÊÇÒ»¸öÍêÕûµÄÇåµ¥£¬ÄúÓн¨Òé¿ÉÒÔÁªÏµÎÒ£¬ÎÒ½«»¶ÓÄúµÄ½¨Ò飬ÒÔ½øÒ»²½¼ÓÇ¿Õâ·½ÃæµÄÇåµ¥¡£
1¡¢http://snippets.dzone.com/tag/c/ --ÊýÒÔǧ¼ ......
ÔÚÀàµÄ¹¹Ô캯ÊýÖÐÌí¼Ó
EnableAutomation();
ÔÚOnInitDialogÖÐÌí¼Ó
SetExternalDispatch(GetIDispatch(TRUE));
ÔÚÀàµÄÉùÃ÷ÖÐÌí¼Óºê
DECLARE_DISPATCH_MAP()
ÔÚÀàµÄʵÏÖÎļþÖÐÌí¼Ó×éºê
BEGIN_DISPATCH_MAP(µ±Ç°Àà, »ùÀà)
END_DISPATCH_MAP()
È»ºó¾Í¿ÉÒÔÓà DISP_FUNCTIONºêÀ´Ó³Éäµ¼³öº¯ ......