26 lines
381 B
C
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;
|
|
}
|