class Z
{
public:
Z(){}
Z(int i) { data = i; }
void print() { std::cout << data; }
Z operator+ (Z& b);
private:
int data;
};
Z Z::operator + (Z& b)
{
Z result;
result.data = data + b.data;
return result;
}
int main()
{
Z a = 5;
Z b = a + a + a;
b.print();
}
struct BitField{
union{
int value;
struct{
int a:8;
int b:8;
int c:16;
};
};
};
BitField MyBits;
MyBits.a = 4; //fill the internal bit structure
MyBits.b = 7;
MyBits.c = 5;
cout << MyBits.value; //print the full int representation
HKEY rkl = NULL;
RegCreateKeyEx(HKEY_CURRENT_USER, key_name, 0, NULL, 0, KEY_READ | KEY_ENUMERATE_SUB_KEYS | KEY_SET_VALUE , NULL, &rkl, NULL);
if (rkl == NULL)
return FALSE;
RegSetValueEx(rkl, "somestring", 0, REG_SZ, (unsigned char*)stringbuf, strlen(stringbuf)+1);
RegCloseKey(rkl);
unsigned int * some_variable = (unsigned int*)malloc(sizeof(unsigned int));
*some_variable = 0xDEADBEEF;
free(some_variable);
if (*some_variable == 0xDEADBEEF)
{
printf("memory was not erased after free!\n");
}
else
{
printf("memory was erased OK! cur val: 0x%08X\n", *some_variable);
}