difference of struct C and C++

[url]http://msdn.microsoft.com/en-us/library/64973255(v=VS.90).aspx[/url]

// struct1.cpp
struct PERSON { // Declare PERSON struct type
int age; // Declare member types
long ss;
float weight;
char name[25];
} family_member; // Define object of type PERSON

int main() {
[b] struct PERSON sister; // C style structure declaration
PERSON brother; // C++ style structure declaration[/b]
sister.age = 13; // assign values to members
brother.age = 7;
}

==============================================
struct POINT { // Declare POINT structure
int x; // Define members x and y
int y;
} spot = { 20, 40 }; // Variable spot has
// values x = 20, y = 40

struct POINT there; // Variable there has POINT type

struct CELL { // Declare CELL bit field
unsigned short character : 8; // 00000000 ????????
unsigned short foreground : 3; // 00000??? 00000000
unsigned short intensity : 1; // 0000?000 00000000
unsigned short background : 3; // 0???0000 00000000
unsigned short blink : 1; // ?0000000 00000000
} screen[25][80]; // Array of bit fields
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值