(C) day 5 wip

This commit is contained in:
kageru 2018-12-05 18:52:24 +01:00
parent 509862683d
commit a54f6d3dc5
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2

View File

@ -1,4 +1,33 @@
#include <stdio.h>
#include <stdlib.h>
struct ArrayWithLength {
int length;
char* content;
};
int isSameLetter(char a, char b) {
char diff = (a > b) ? a - b : b - a;
return diff == 32;
}
struct ArrayWithLength processArray(char* input, int length) {
char output [length];
int outputLength = 0;
for (int i=0; i<length-1; i++) {
if (isSameLetter(input[i], input[i+1]) == 1) {
i++;
} else {
output[outputLength] = input[i];
outputLength++;
}
}
struct ArrayWithLength ret;
ret.length = outputLength;
ret.content = output;
return ret;
}
int main() {
return 0;
}