1 #include <pthread.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 5 char *pointer; 6 7 void *f1(void *p) { 8 pointer[0] = 'x'; // thread1 line 9 return NULL; 10 } 11 12 void *f2(void *p) { 13 pointer[0] = 'y'; // thread2 line 14 return NULL; 15 } 16 17 int main (int argc, char const *argv[]) 18 { 19 pointer = (char *)malloc(10); // malloc line 20 21 pthread_t t1, t2; 22 pthread_create(&t1, NULL, f1, NULL); 23 pthread_create(&t2, NULL, f2, NULL); 24 25 pthread_join(t1, NULL); 26 pthread_join(t2, NULL); 27 28 return 0; 29 } 30