init
This commit is contained in:
25
Test/c03/ex00/main.c
Normal file
25
Test/c03/ex00/main.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char src1[] = "dddd";
|
||||
char dest1[8] = "ddde";
|
||||
int result1;
|
||||
|
||||
result1 = strcmp(dest1, src1);
|
||||
printf("%d", result1);
|
||||
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
||||
char src2[] = "dddd";
|
||||
char dest2[8] = "ddde";
|
||||
int result2;
|
||||
|
||||
result2 = ft_strcmp(dest2, src2);
|
||||
printf("%d", result2);
|
||||
return 0;
|
||||
}
|
||||
|
25
Test/c03/ex01/main.c
Normal file
25
Test/c03/ex01/main.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char src1[] = "dddd";
|
||||
char dest1[8] = "ddde";
|
||||
int result1;
|
||||
|
||||
result1 = strncmp(dest1, src1, 4);
|
||||
printf("%d", result1);
|
||||
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
||||
char src2[] = "dddd";
|
||||
char dest2[8] = "ddde";
|
||||
int result2;
|
||||
|
||||
result2 = ft_strncmp(dest2, src2, 4);
|
||||
printf("%d", result2);
|
||||
return 0;
|
||||
}
|
||||
|
23
Test/c03/ex02/main.c
Normal file
23
Test/c03/ex02/main.c
Normal file
@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char src1[] = "debut";
|
||||
char dest1[8] = "fin";
|
||||
|
||||
strcat(dest1, src1);
|
||||
printf(dest1);
|
||||
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
||||
char src2[] = "debut";
|
||||
char dest2[8] = "fin";
|
||||
|
||||
ft_strcat(dest2, src2);
|
||||
printf(dest2);
|
||||
return 0;
|
||||
}
|
||||
|
29
Test/c03/ex03/main.c
Normal file
29
Test/c03/ex03/main.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main () {
|
||||
char src1[50], dest1[50];
|
||||
|
||||
strcpy(src1, "This is source");
|
||||
strcpy(dest1, "This is destination");
|
||||
|
||||
strncat(dest1, src1, 10);
|
||||
|
||||
printf("%s", dest1);
|
||||
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
||||
char src2[50], dest2[50];
|
||||
|
||||
strcpy(src2, "This is source");
|
||||
strcpy(dest2, "This is destination");
|
||||
|
||||
ft_strncat(dest2, src2, 10);
|
||||
|
||||
printf("%s", dest2);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
28
Test/c03/ex04/main.c
Normal file
28
Test/c03/ex04/main.c
Normal file
@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
int main (void) {
|
||||
char haystack1[20] = "TutorialsPoint";
|
||||
char needle1[10] = "Point";
|
||||
char *ret1;
|
||||
|
||||
ret1 = strstr(haystack1, needle1);
|
||||
|
||||
printf("The substring is: %s\n", ret1);
|
||||
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
||||
char haystack2[20] = "TutorialsPoint";
|
||||
char needle2[10] = "Point";
|
||||
char *ret2;
|
||||
|
||||
ret2 = ft_strstr(haystack2, needle2);
|
||||
|
||||
printf("The substring is: %s\n", ret2);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
12
Test/c03/ex05/main.c
Normal file
12
Test/c03/ex05/main.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
char src[] = "hello";
|
||||
char dest2[5] = "fjff";
|
||||
int j;
|
||||
|
||||
j = ft_strlcat(src, dest2, 5);
|
||||
|
||||
printf("%d %s\n", j, dest2);
|
||||
}
|
||||
|
Reference in New Issue
Block a user