-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchars_test - Copy.cpp
109 lines (108 loc) · 2.2 KB
/
chars_test - Copy.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <iostream>
using namespace std;
typedef struct {
char* o; //Very right letter
char* t;
char* h;
char* th; //Very left letter
} chars;
/*
//SEG FAULT
chars* makeChars(char* input) {
printf("One");
int len = sizeof(input)/sizeof(char);
chars* output;
printf("Two");
output->o = malloc(sizeof(char));
output->t = malloc(sizeof(char));
output->h = malloc(sizeof(char));
output->th = malloc(sizeof(char));
printf("Three");
if(len == 4) {
printf("Four");
strcpy(output->th, input);
strcpy(output->h, input + sizeof(char));
strcpy(output->t, input + 2 * sizeof(char));
strcpy(output->o, input + 3 * sizeof(char));
printf("5");
} else if(len == 3) {
printf("6");
strcpy(output->h, input);
strcpy(output->t, input + sizeof(char));
strcpy(output->o, input + 2 * sizeof(char));
printf("7");
} else if(len == 2) {
printf("8");
strcpy(output->t, input);
strcpy(output->o, input + sizeof(char));
printf("9");
} else {
printf("10");
strcpy(output->o, input);
printf("11");
}
printf("12");
return output;
}
chars* plusPlus(chars* input) {
*input->o++;
if(*input->o == '{') {
*input->o = 'a';
if(*input->t == '\0') {
*input->t = 'a';
return input;
} else {
*input->t++;
if(*input->t == '{') {
*input->t = 'a';
if(*input->h == '\0') {
*input->h = 'a';
return input;
} else {
*input->h++;
if(*input->h == '{') {
*input->h = 'a';
if(*input->th == '\0') {
*input->th = 'a';
return input;
} else {
*input->th++;
if(*input->th == '{')
*input->th = 'a';
return input;
}
}
}
}
}
}
}
char* returnCharArray(chars* input) {
int length = 1;
if(*input->th != '\0')
length = 4;
else if(*input->h != '\0')
length = 3;
else if(*input->t != '\0')
length = 2;
char* output;
if(*input->th != '\0')
strcpy(input->th, output);
if(*input->h != '\0')
strcpy(input->h, output);
if(*input->t != '\0')
strcpy(input->t, output);
strcpy(input->o, output);
}
*/
int main() {
//printf("Hey");
char begin[] = "aaa";
//strcpy(out, "a");
printf("Howdy");
//chars* a = makeChars(out);
printf("last");
//cout << a << endl;
//plusPlus(a);
//cout << returnCharArray(a) << endl;
}