start adding low level functionality to help with future development

This commit is contained in:
2024-05-07 16:33:30 +01:00
parent 635aa98a1a
commit 6173c18be6
13 changed files with 696 additions and 35 deletions

View File

@@ -1,10 +1,16 @@
#include "cloneString/cloneString.h"
#include "string/string.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
const char* str = "Hello, World!";
char* str = malloc(100 * sizeof(char));
if (str == NULL) {
printf("Failed to allocate memory\n");
return 1;
}
strcpy(str, " \t\n\r\f\vHello, World! \t\n\r\f\v");
char* clone = cloneString(str);
if (clone == NULL) {
@@ -12,10 +18,15 @@ int main() {
return 1;
}
printf("Original string: %s\n", str);
printf("Cloned string: %s\n", clone);
stripString(clone, WHITE_SPACE);
printf("Original string: \"%s\"\n", str);
free(str);
printf("Cloned string: \"%s\"\n", clone);
free(clone);
return 0;
}
}