Untitled
unknown
plain_text
2 years ago
550 B
12
Indexable
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
void *compute();
int main(){
        pthread_t th1;
        long value1 = 10;
        pthread_create(&th1, NULL, compute, &value1);
        pthread_join(th1, NULL);
        return 0;
}
void *compute(void *limit){
        int* i = (int*) limit;
        for(int j = 0; j <=  *i; j++){
                if(j%2 == 0){
                        printf("%d: Even\n", j);
                } else {
                        printf("%d: Odd\n", j);
                }
        }
}Editor is loading...