-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
72 lines (50 loc) · 1.35 KB
/
main.c
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
#include <stdio.h>
#include "mystring_demo.h"
#include "MyString.h"
int main2()
{
test1();
test2();
MyString* arr[5];
arr[0] = myStringAlloc();
arr[1] = myStringAlloc();
arr[2] = myStringAlloc();
arr[3] = myStringAlloc();
arr[4] = myStringAlloc();
myStringSetFromCString(&arr[0],"Fuck this FUCKIN FUCK");
myStringSetFromCString(&arr[1],"Oh My GOD i HATE C");
myStringSetFromCString(&arr[2],"Fuck this So Annoying");
myStringSetFromCString(&arr[3],"Fuck I cant stand this");
myStringSetFromCString(&arr[4],"Fuck me.");
printf("%lu\n", myStringMemUsage(arr[0]));
printf("comparing 2 strings: %d\n",myStringCompare(arr[2],arr[4]));
for (int i = 0; i < 5; ++i)
{
char* curString = myStringToCString(arr[i]);
printf("string num %i is: %s\n",i,curString);
}
myStringSort(arr,5);
for (int i = 0; i < 5; ++i)
{
char* curString = myStringToCString(arr[i]);
printf("string num %i is: %s\n",i,curString);
}
/*
FILE *f = fopen("test.out", "w");
if (f == NULL)
{
printf("Error opening file!\n");
exit(1);
}
const char *strA;
const char *strB;
//not code repetition this is not code repetition this is not code repetition this is not code repetition
printf("Enter string A:\n");
scanf ( "%500s", strA);
printf("Enter string B:\n");
scanf ( "%500s", strB);
int result = myStringCompare(strA,strB);
fclose(f);
*/
return 0;
}