c_mem_safety/handle_test.c
2025-04-24 20:14:43 +02:00

26 lines
381 B
C

#include <stdio.h>
#include "handle.h"
struct Meaning {
int a;
int b;
};
handle(struct Meaning) {
if(state == HANDLE_CREAT) {
this->a = *(int*) data;
this->b = 2
} else {
printf("%d\n", this->a + this->b);
}
}
// Now you can use a handle in your local scopes
// Should print 42:
int main() {
int initializer = 40;
creat(struct Data, d, &initializer);
return 0;
}