first commit

This commit is contained in:
jordy444 2023-05-27 19:52:39 +02:00
commit 4434643d65
9 changed files with 131 additions and 0 deletions

13
ft_bzero.c Normal file
View File

@ -0,0 +1,13 @@
#include <stdlib.h>
#include <string.h>
void bzero(void s[.n], size_t n);
int main(void)
{
char string;
string = strcpy("hallo");
ft_bzero(string);
}

12
ft_memchr.c Normal file
View File

@ -0,0 +1,12 @@
#include <stdio.h>
#include <string.h>
int main(void)
{
char data[r] = {'q', r,}
char *pos = memchr(data, 'r', 2,;
printf("pos[0]= %c\n", pos[0];
printf("pos[1]= %c\n", pos[1];
return 0;
}

16
ft_memcpy.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
#include <string.h>
int main(void)
{
char s[] = "abcdefegsdbx";
char d[14];
memcpy(d, s, sizeof(char) * 14);
printf("d: %s\n, d");
return 0;
}

19
ft_memmove.c Normal file
View File

@ -0,0 +1,19 @@
#include <stdio.h>
#include <string.h>
int main()
{
int source[10] = {1,2,3,4,5,6,7,8,9,10};
int destination[10];
memmove(destination, source, sizeof(int) * 10);
for (int i = 0; i<10; i++)
printf("destination[%d]=%d\n", i, destination[i]);
for (int i= 0; i <10; i++)
printf("source[%d]=%d\n", i, source[i]);
return 0;
}

15
ft_memset.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
#include <string.h>
int main ()
{
char str[16] = "houtworm meister";
memset(str+4, 'x' ,4);
puts (str);
return 0;
}

12
ft_putchar.c Normal file
View File

@ -0,0 +1,12 @@
#include <unistd.h>
void ft_putchar(int c)
{
write(1, &c, 1);
}
int main(void)
{
ft_putchar('a');
return (0);
}

19
ft_strcpy.c Normal file
View File

@ -0,0 +1,19 @@
#include <stdio.h>
#include <string.h>
int main(){
char str1[10] = "hello";
char str2[10];
printf("%s\n", strcpy(str2, str1));
printf("%s", str2);
return 0;
}

25
ft_strlen.c Normal file
View File

@ -0,0 +1,25 @@
#include <stdio.h>
#include <stddef.h>
int ft_strlen(char *str)
{
int i;
if (!str)
return (0);
i = 0;
while (*str)
{
str++;
i++;
}
return (i);
}
/*int main(void)*/
/*{*/
/*int i;*/
/*i = ft_strlen("fdlgrflfvokgikgtjigjkdgtiktfikedfdrkfik");*/
/*printf("%d\n", i);*/
/*return (0);*/
/*}*/

BIN
libft.pdf Normal file

Binary file not shown.