69,394
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <stdlib.h>
#define Nothing NULL
typedef struct {
void* thing;
} Maybe;
Maybe foo(void *thing) {
return (Maybe){.thing = thing};
}
Maybe testa(void* thing) {
(*(int*)thing) += 30;
}
Maybe testb(void* thing) {
(*(int*)thing) -= 20;
}
Maybe testc(void* thing) {
(*(int*)thing) *= 10;
}
int main() {
int a = 10;
Maybe x = foo(&a);
Maybe y = testa(x.thing);
printf("%d\n", *((int*)y.thing));
return 0;
}