Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <sys/types.h>
- #include <unistd.h>
- #include <stdlib.h>
- #include <pthread.h>
- struct t {
- void (*a)();
- }obj;
- void a() {
- printf("Hey there\n");
- }
- void terminate(struct t *obj) {
- free(obj); //free
- }
- int main() {
- struct t *obj;
- obj = malloc(64);
- obj->a = a;
- fork(); //I call fork here so create a child process, after this it should call terminate 2 times or shouldn't?
- terminate(obj);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement