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
Ïà¹ØÎĵµ£º
n Óñêʶ·û´ú±íÒ»¸ö³£Á¿£¬³ÆÎª·ûºÅ³£Á¿¡£ n ·ûºÅ³£Á¿Óë±äÁ¿²»Í¬£¬ËüµÄÖµÔÚÆä×÷ÓÃÓòÄÚ²»Äܸı䣬Ҳ²»ÄÜÔÙ±»¸³Öµ¡£ n ʹÓ÷ûºÅ³£Á¿µÄºÃ´¦ÊÇ£º Ø º¬ÒåÇå³þ£» Ø ÄÜ×öµ½¡°Ò»¸ÄÈ«¸Ä¡±¡£ --»°Ëµ£º²»ÖªµÀcÀïÃæÓÐûÓÐÈ«¾Ö±äÁ¿µÄ¶«¶«£¬Óеϰ£¬ÕâÁ½¸öµÄʵ¼ÊÓô¦ÓÐɶ×ÓÇø±ðÄØ£¿¿´¿´ÔÙ˵ Êý¾Ý½á¹¹+Ëã·¨=³ÌÐò ÖÕÓÚÖªµÀÕâ ......
#include "stdio.h"
#include "malloc.h"
typedef int elemtype;
struct node
{
elemtype data;
struct node *next;
};
typedef struct node NODE;
NODE * creat(NODE *head)
{
NODE *p,*q;
elemtype i;
head=(NODE*)malloc(sizeof(NODE));
scanf("%d",&(head->data));
p=head;
......
#include "stdio.h"
#include "math.h"
#include "time.h"
#define INTERVAL 1 ¶¨ÒåºêµÄʱ¼ä¼ä¸ôΪ1Ãë
//
void On_Time() //ÿһÃ뼤·¢µÄʼþ
{
printf("now=%s\n","JJK");
}
void Timer() //ʱÖӵĺ¯Êý
{ time_t newclk,oldclk;
while(1)
&nb ......
±¾ÎÄÊ×·¢µØÖ·£ºhttp://blog.csdn.net/liigo/archive/2009/09/22/4582018.aspx
×ªÔØÇë×¢Ã÷³ö´¦£ºhttp://blog.csdn.net/liigo
×÷Õߣºliigo, 2009/09/22
¡¡¡¡ÔÚÏÂΧÆåʱ£¬µ±Ò»¸öÆå×ÓÂäµ½ÆåÅÌÉÏ£¬Ëü»á¶ÔÖÜΧ¶Ô·½Æå×ÓµÄËÀ»î²úÉúÓ°Ï죬Èç¹û¶Ô·½Æå×ÓûÓÐÆøÁË£¨ËÀÁË£©£¬±ØÐë´ÓÆåÅÌÉÏÄõô£¨Ìá×Ó£©¡£Õâ¸ö¹ý³ÌÌåÏÖµ½Î§ÆåÈí¼þÖУ¬¾ÍÐ ......
µÚ¶þÕ cÓïÑÔ¸ÅÊö
Ò»¸ö¼òµ¥µÄʵÀý
#include <stdio.h>
int main(void)
{
int num; /*¶¨Òå±äÁ¿num*/
num = 1; /*¸ø±äÁ¿num¸³Öµ*/
printf("I am a simple"); /*ʹÓÃprintf()º¯Êý*/
& ......