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

C/C++ÔËËã·ûµÄÓÅÏȼ¶


Precedence Operator Description Example Overloadable Associativity
1
::
Scope resolution operator
Class::age = 2;
no
none
2
()
()
[]
->
.
++
--
const_cast
dynamic_cast
static_cast
reinterpret_cast
typeid
Function call
Member initalization
Array access
Member access from a pointer
Member access from an object
Post-increment
Post-decrement
Special cast
Special cast
Special cast
Special cast
Runtime type information
isdigit('1')
c_tor(int x, int y) : _x(x), _y(y*10){};
array[4] = 2;
ptr->age = 34;
obj.age = 34;
for( int i = 0; i < 10; i++ ) cout << i;
for( int i = 10; i > 0; i-- ) cout << i;
const_cast<type_to>(type_from);
dynamic_cast<type_to>(type_from);
static_cast<type_to>(type_from);
reinterpret_cast<type_to>(type_from);
cout « typeid(type).name();
yes
yes
yes
yes
no
yes
yes
no
no
no
no
no
left to right
3
!
not
~
compl
++
--
-
+
*
&
new
new []
delete
delete []
(type)
sizeof
Logical negation
Alternate spelling for !
Bitwise complement
Alternate spelling for ~
Pre-increment
Pre-decrement
Unary minus
Unary plus
Dereference
Address of
Dynamic memory allocation
Dynamic memory allocation of array
Deallocating the memory
Deallocating the memory of array
Cast to a given type
Return size of an object or type
if( !done ) …
flags = ~flags;
for( i = 0; i < 10; ++i ) cout << i;
for( i = 10; i > 0; --i ) cout << i;
int i = -1;
int i = +1;
int data = *intPtr;
int *intPtr = &data;
long *pVar = new long;
MyClass *ptr = new MyClass(args);
delete pVar;
delete [] array;
int i = (int) floatNum;\\int size = sizeof(float);
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
right to left
4
->*
.*
Member pointer selector
Member object selector
ptr->*var = 24;
obj.*var = 24;
yes
no
left to right
5
*
/
%
Multiplication
Division
Modulus
int i = 2 * 4;
floa


Ïà¹ØÎĵµ£º

¶¨ÒåC/C++È«¾Ö±äÁ¿/³£Á¿¼¸ÖÖ·½·¨µÄÇø±ð

ÔÚÌÖÂÛÈ«¾Ö±äÁ¿Ö®Ç°ÎÒÃÇÏÈÒªÃ÷°×¼¸¸ö»ù±¾µÄ¸ÅÄ
 
1. ±àÒëµ¥Ôª(Ä£¿é)£º
    ÔÚIDE¿ª·¢¹¤¾ß´óÐÐÆäµÀµÄ½ñÌ죬¶ÔÓÚ±àÒëµÄһЩ¸ÅÄîºÜ¶àÈËÒѾ­²»ÔÙÇå³þÁË£¬ºÜ¶à³ÌÐòÔ±×îŵľÍÊÇ´¦ÀíÁ¬½Ó´íÎó(LINK ERROR), ÒòΪËü²»Ïñ±àÒë´íÎóÄÇÑù¿ÉÒÔ¸ø³öÄã³ÌÐò´íÎóµÄ¾ßÌåλÖã¬Äã³£³£¶ÔÕâÖÖ´íÎó¸Ðµ½°ÃÄÕ£¬µ«ÊÇÈç¹ûÄã¾ ......

¹ØÓÚdelete C/C++ Ö¸Õë

Õ»£ºº¯Êýµ÷ÓõÄʱºò£¬ÔÚÕ»Öб£´æ¾Ö²¿±äÁ¿ºÍº¯Êý²ÎÊýµÈ¡£µ±º¯Êý·µ»Øʱ£¬×Ô¶¯Çå³ýÕ»¡£
×ÔÓÉ´æ´¢Çø£ºÒ²³ÆΪ¶Ñ(heap)£¬¿ÉÒÔ¿´×÷´óÁ¿µÄÄÚ´æ¶Î¡£Í¨¹ý new ²Ù×÷·û·ÖÅäµÄÄÚ´æÔÚ¶ÑÖС£³ÌÐò½áÊø֮ǰ²»×Ô¶¯Çå³ý×ÔÓÉ´æ´¢Çø¡£ÐèÒªÓɳÌÐòÀ´¸ºÔðÊÍ·Å£¨delete£©¡£
1.
¶ÔÖ¸ÏòÕ»ÉÏÄÚ´æµÄÖ¸Õëµ÷ÓÃdelete»áµ¼Ö³ÌÐòCrash¡£
2. 
new ½ø ......

C/C++½á¹¹Ìå×Ö½Ú¶ÔÆë


[×¢]£º×î½üÔÚ×öUVCÃèÊö·ûµÄ±à¼­¹¤¾ß£¬Óõ½ºÜ¶àµÄ½á¹¹£¬ÎªÁË·½±ã°Ñ½á¹¹Ìåд³ÉbinÎļþ£¬ÐèÒª°Ñ½á¹¹ÌåÖÐÌî³äµÄ×Ö½ÚÈ¥µô£¬ÔÚÍøÉÏËÑË÷µÃµ½ÕâƪÎÄÕ£¬¸Ð¾õͦºÃµÄ£¬×ª¹ýÀ´×ö¸ö¼ÍÄî¡£
½á¹¹Ìå(struct)µÄsizeofÖµ£¬²¢²»ÊǼòµ¥µÄ½«ÆäÖи÷ÔªËØËùÕ¼×Ö½ÚÏà¼Ó£¬¶øÊÇÒª¿¼Âǵ½´æ´¢¿Õ¼äµÄ×Ö½Ú¶ÔÆëÎÊÌâ¡£ÏÈ¿´ÏÂÃ涨ÒåµÄÁ½¸ö½á¹¹Ìå.
struct ......

zzlinuxÏÂÀûÓÃman²é¿´Cº¯ÊýºÍÖÐÎÄmanÅäÖÃ

ÔÚLinuxÏÂд³ÌÐò£¬Óöµ½Ò»¸öº¯Êý²»ÖªµÀÔõôÓþ͵ÃÉÏÍøÈ¥²é£¬Ã»ÓÐÀàËÆMSDNÖ®ÀàµÄÈí¼þ£¬·³µÃºÜ¡£¿´µ½ÍøÉϺܶàÈ˶¼ËµÓÃmanºÜ·½±ã£¬Ö»ÒªmanÒ»ÏÂÄãÏëÁ˽âµÄº¯Êý¾ÍÐÐÁË£¬¿ÉÎÒÔÚmanÖ®ºóʲô¶¼µÃ²»µ½£¬±ÈÈç man printf£¬½á¹û¾ÍÊÇûÓÐÈë¿Ú
½ñÌìרÃÅÉÏÍøËÑÁËÏ£¬·¢ÏÖÔ­À´ÊÇÒòΪUbuntuĬÈÏûÓÐ×°manpages-dev£¬¶øº¯Êý¶¼ÔÚÕâ¸ö°üÀ°ÑÕ ......

ΧÆå´òÆ×Èí¼þÖÐ×Ô¶¯Ìá×Ó¹¦ÄܵÄʵÏÖ£¬C/C++Ô´Âë

±¾ÎÄÊ×·¢µØÖ·£ºhttp://blog.csdn.net/liigo/archive/2009/09/22/4582018.aspx
תÔØÇë×¢Ã÷³ö´¦£ºhttp://blog.csdn.net/liigo
×÷Õߣºliigo, 2009/09/22
¡¡¡¡ÔÚÏÂΧÆåʱ£¬µ±Ò»¸öÆå×ÓÂäµ½ÆåÅÌÉÏ£¬Ëü»á¶ÔÖÜΧ¶Ô·½Æå×ÓµÄËÀ»î²úÉúÓ°Ï죬Èç¹û¶Ô·½Æå×ÓûÓÐÆøÁË£¨ËÀÁË£©£¬±ØÐë´ÓÆåÅÌÉÏÄõô£¨Ìá×Ó£©¡£Õâ¸ö¹ý³ÌÌåÏÖµ½Î§ÆåÈí¼þÖУ¬¾ÍÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ