易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

linux 系统下使用C程序实现时钟的函数

#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 ......

Windows下C网络编程入门

http://blog.csdn.net/Ackarlix/archive/2007/08/25/1758412.aspx
Windows下C网络编程入门
C语言的学习,一般的方式是,先学C,然后是C++,最好还要有汇编语言和微机原理基础,然后才是Visual C++。这样的方式,对学习者来说,要花费很多时间和耐力。而在学校教学中,也没有时间深入学习Windows编程的实用技术了。
   ......

C/C++ 指向子类对象的基类指针

有如下程序:
//-----------------
class A
{
public:
A()
{
printf( "base A\r\n" );
}
virtual ~A()
{
printf( "base ~A\r\n" );
}
public:
virtual void VirtualFunc()
{
printf( "base VirtualFunc\r\n" );
};
void Func()
{
printf( "base Func\r\n" );
}
void F1()
{
pr ......

C/C++结构体字节对齐


[注]:最近在做UVC描述符的编辑工具,用到很多的结构,为了方便把结构体写成bin文件,需要把结构体中填充的字节去掉,在网上搜索得到这篇文章,感觉挺好的,转过来做个纪念。
结构体(struct)的sizeof值,并不是简单的将其中各元素所占字节相加,而是要考虑到存储空间的字节对齐问题。先看下面定义的两个结构体.
struct ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号