start adding low level functionality to help with future development
This commit is contained in:
21
src/main.c
21
src/main.c
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user