RECT Structure
The RECT data structure has the following form:typedef struct tagRECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.MembersleftSpecifies the x-coordinate of the upper-left corner of a rectangle.topSpecifies the y-coordinate of the upper-left corner of a rectangle.rightSpecifies the x-coordinate of the lower-right corner of a rectangle.bottomSpecifies the y-coordinate of the lower-right corner of a rectangle.Example//Alternate ways to intialize a RECT structure:RECT rctA;
rctA.left = 20;
rctA.top = 30;
rctA.right = 180;
rctA.bottom = 230;RECT rctB = {20,30,180,230};--------------------------------
UINT Unsigned INT. 不是UNIT
--------------------------------
sizeof Operator
sizeof expressionThe sizeof keyword gives the amount of storage, in bytes, associated with a variable or a type (including aggregate types). This keyword returns a value of type size_t.The expression is either an identifier or a type-cast expression (a type specifier enclosed in parentheses).When applied to a structure type or variable, sizeof returns the actual size, which may include padding bytes inserted for alignment. When applied to a statically dimensioned array, sizeof returns the size of the entire array. The sizeof operator cannot return the size of dynamically allocated arrays or external arrays.For related information, see Operators.Example// Example of the sizeof keyword
size_t i = sizeof( int ); struct align_depends {
char c;
int i;
};
size_t size = sizeof(align_depends); // The value of size depends on
// the value set with /Zp or
// #pragma packint array[] = { 1, 2, 3, 4, 5 }; // sizeof( array ) is 20
// sizeof( array[0] ) is 4
size_t sizearr = // Count of items in array
sizeof( array ) / sizeof( array[0] );
The RECT data structure has the following form:typedef struct tagRECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.MembersleftSpecifies the x-coordinate of the upper-left corner of a rectangle.topSpecifies the y-coordinate of the upper-left corner of a rectangle.rightSpecifies the x-coordinate of the lower-right corner of a rectangle.bottomSpecifies the y-coordinate of the lower-right corner of a rectangle.Example//Alternate ways to intialize a RECT structure:RECT rctA;
rctA.left = 20;
rctA.top = 30;
rctA.right = 180;
rctA.bottom = 230;RECT rctB = {20,30,180,230};--------------------------------
UINT Unsigned INT. 不是UNIT
--------------------------------
sizeof Operator
sizeof expressionThe sizeof keyword gives the amount of storage, in bytes, associated with a variable or a type (including aggregate types). This keyword returns a value of type size_t.The expression is either an identifier or a type-cast expression (a type specifier enclosed in parentheses).When applied to a structure type or variable, sizeof returns the actual size, which may include padding bytes inserted for alignment. When applied to a statically dimensioned array, sizeof returns the size of the entire array. The sizeof operator cannot return the size of dynamically allocated arrays or external arrays.For related information, see Operators.Example// Example of the sizeof keyword
size_t i = sizeof( int ); struct align_depends {
char c;
int i;
};
size_t size = sizeof(align_depends); // The value of size depends on
// the value set with /Zp or
// #pragma packint array[] = { 1, 2, 3, 4, 5 }; // sizeof( array ) is 20
// sizeof( array[0] ) is 4
size_t sizearr = // Count of items in array
sizeof( array ) / sizeof( array[0] );
typedef struct tagRECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;
typedef struct _RECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;
表示了以(left,top)为左上角顶点,以(right,bottom)为有下脚顶点的矩形范围。二,UINT就是unsigned int 数据类型。三,sizeof是标准C++提供的库函数,它返回一个对象在内存中所占的字节数。
eg:int i;
sizeof(i);返回int型在内存中占的字节数4。
短信息的内容:
谢谢你详细的解答. 但我对unsigned int的概念还是有点模糊,因为书上没有讲,所以请你解答,它和INT类型有什么不同呢?可以举个例子吗?回答:
int 类型有正负号
unsigned int 类型没有正负号之分,只有正号。
短信息的内容:
谢谢你详细的解答. 但我对unsigned int的概念还是有点模糊,因为书上没有讲,所以请你解答,它和INT类型有什么不同呢?可以举个例子吗?回答:
int 类型有正负号
unsigned int 类型没有正负号之分,只有正号。