gpt/2025-11-07/union.c (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#include <assert.h>
/* beende das Initialisieren der Flags */
const short FLAG_ON = 1 << 0; // 1 (0x01)
const short FLAG_MOVEMENT = 1 << 1; // 2 (0x02)
const short FLAG_TRANSPARENT = 1 << 2; // 4 (0x04)
const short FLAG_ALIVE = ;
const short FLAG_BROKEN = ;
const short FLAG_EDIBLE = 1 << 5; // 32 (0x20)
int main() {
short attributes = 0;
/* setze die Attribute ON, TRANSPARENT, und BROKEN */
assert(attributes == FLAG_ON | FLAG_TRANSPARENT | FLAG_BROKEN);
/* verandere (set/clear/toggle) sodass die einzigen Attribute ON und ALIVE sind */
assert(attributes == FLAG_ON | FLAG_ALIVE);
/* checke, ob das ALIVE flag gesetzt ist */
assert(/* ??? */);
/* checke, ob das BROKEN flag nicht gesetzt ist */
assert(/* ??? */);
/* verändere so, dass nur das EDIBLE Attribut gesetzt ist */
assert(attributes == FLAG_EDIBLE);
}
|