c-exercises/structs.c

19 lines
256 B
C

#include <assert.h>
struct test {
int foo;
};
typedef struct test test_t;
int main(void) {
test_t a = { 23 };
test_t b = { 42 };
a = b;
assert(a.foo == 42);
assert(b.foo == 42);
a.foo = 69;
assert(a.foo == 69);
assert(b.foo == 42);
}