diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-11-22 03:05:58 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-11-22 03:18:48 +0100 |
| commit | a917ec555ef8419bf638d6b8f87c965dff96e9e1 (patch) | |
| tree | a18ab385f8e5a5c115d157324f8d2a3966b0003d /main.c | |
| parent | b22183ba021d9ab3418d8f47545708597247e583 (diff) | |
| download | libasm-a917ec555ef8419bf638d6b8f87c965dff96e9e1.tar.gz libasm-a917ec555ef8419bf638d6b8f87c965dff96e9e1.tar.bz2 libasm-a917ec555ef8419bf638d6b8f87c965dff96e9e1.zip | |
ft_strdup.s and Makefile
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 50 |
1 files changed, 25 insertions, 25 deletions
@@ -6,52 +6,52 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/22 02:02:24 by cacharle #+# #+# */ -/* Updated: 2019/11/22 02:14:53 by cacharle ### ########.fr */ +/* Updated: 2019/11/22 03:17:39 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include <stdio.h> +#include <stdlib.h> int ft_strlen(char *); char *ft_strcpy(char *dst, const char *src); int ft_strcmp(const char *s1, const char *s2); int ft_write(int, const void*, size_t); int ft_read(int, void*, size_t); - +char *ft_strdup(const char*); int main() { - /* char *a = ""; */ - /* char *b = "a"; */ - - /* printf("%d\n", sizeof(char*)); */ - /* printf("a: %p\n", (void*)a); */ - /* printf("b: %p\n", (void*)a); */ - /* extern ft_strlen("bonjour"); */ - /* printf("%d\n", ft_strlen(a)); */ - /* printf("%d\n", ft_strlen(b)); */ - /* printf("%d\n", ft_strlen("bonjour")); */ - - - /* char c[32] = "bon"; */ - /* char *d = "bonjourasdfasdf"; */ - /* */ - /* printf("%s\n", ft_strcpy(c, d)); */ - /* printf("%s\n", c); */ - + char *a = ""; + char *b = "a"; + printf("%d\n", sizeof(char*)); + printf("a: %p\n", (void*)a); + printf("b: %p\n", (void*)a); + printf("%d\n", ft_strlen(a)); + printf("%d\n", ft_strlen(b)); + printf("%d\n", ft_strlen("bonjour")); + + char c[32] = "bon"; + char *d = "bonjourasdfasdf"; + printf("%s\n", ft_strcpy(c, d)); + printf("%s\n", c); char *e = "\x03"; char *f = "\x02"; printf("%d\n", ft_strcmp(e, f)); printf("%d\n", strcmp(e, f)); - /* ft_write(1, "bon\n", 4); */ + ft_write(1, "bon\n", 4); + + char g[32]; + int ret = ft_read(0, g, 2); + g[ret] = 0; + printf("%s\n", g); - /* char g[32]; */ - /* int ret = ft_read(0, g, 2); */ - /* g[ret] = 0; */ - /* printf("%s\n", g); */ + char *h = ft_strdup("bonjour"); + printf("%s\n", h); + free(h); return 0; } |
