I have a struct
typedef struct something_t {
int a;
int b;
} VALUES;
In my thread function I do
VALUES values;
values.a = 10;
values.b = 11;
pthread_exit((void*)&values);
And I try to receive by doing
VALUES values;
pthread_join(thread, (void*)&values);
printf("A: %d\B: %d\n", values.a, values.b);
The values I receive are weird every time. I am confused about how to receive the values that I end up creating in the thread. I am trying to learn threads in C and seems like I have grasped it, but I can't return values. Is there a way? Thanks to anyone for their help.