-
Notifications
You must be signed in to change notification settings - Fork 0
/
alphanumeric.cpp
52 lines (44 loc) · 1.25 KB
/
alphanumeric.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <ctype.h>
// isdigit()
// isalpha()
int currentIndex = 1;
int arrayLength; //argc
void *numeric(char* myStr[]) {
int internalIndex;
while (currentIndex < arrayLength) {
internalIndex = currentIndex;
if(isdigit(myStr[internalIndex][0])) {
printf("numeric: %s\n", myStr[internalIndex]);
currentIndex++;
}
while (internalIndex == currentIndex) {
continue;
}
}
}
void *alpha(char* myStr[]) {
int internalIndex;
while (currentIndex < arrayLength) {
internalIndex = currentIndex;
if(isalpha(myStr[internalIndex][0])) {
printf("alpha: %s\n", myStr[internalIndex]);
currentIndex++;
}
while (internalIndex == currentIndex) {
continue;
}
}
}
int main(int argc, char* argv[]) {
arrayLength = argc;
pthread_t alpha_thread, num_threadl;
pthread_create(&alpha_thread, NULL, reinterpret_cast<void* (*)(void*)>(alpha), argv);
pthread_create(&num_threadl, NULL, reinterpret_cast<void* (*)(void*)>(numeric), argv);
pthread_join(alpha_thread, NULL);
pthread_join(num_threadl, NULL);
return 0;
}