There is a thread1 where I enter an alphabet,
then in thread2 there I have to convert the character to its uppercase/lowercase and print that using a thread3... ??!!
Here is a rough code that I tried :
Code:
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <ctype.h>
void *input() {
char chr;
printf("Enter a character: ");
scanf("%c", &chr);
}
void *upper_case(void *c) {
char a;
a = (char) c;
if(isupper(a)) printf("\n%c", tolower(a));
else if(islower(a)) printf("\n%c", toupper(a));
else printf("\nOMG !");
}
void *print(void *c) {
char str;
str = (char) c;
printf("%c", c);
}
int main(void) {
pthread_t p1, p2, p3;
pthread_create(&p1, NULL, input, NULL);
pthread_create(&p2, NULL, upper_case, (void*));
pthread_create(&p2, NULL, print, (void*));
.
.
.
.
I don't know what to do now ?? :(
Please help !!!