aboutsummaryrefslogtreecommitdiff
path: root/c08/main.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-07-15 10:20:37 +0200
committerCharles <sircharlesaze@gmail.com>2019-07-15 10:20:37 +0200
commit217bcb0d4e3ba60604921cb40d5a11a64f93cfc7 (patch)
tree32a8f1f84e0b5f3617988932ccc068d471207208 /c08/main.c
parent3b9a1d7dcc5683b962f2bf24795e80e1c449cd1f (diff)
downloadpiscine-217bcb0d4e3ba60604921cb40d5a11a64f93cfc7.tar.gz
piscine-217bcb0d4e3ba60604921cb40d5a11a64f93cfc7.tar.bz2
piscine-217bcb0d4e3ba60604921cb40d5a11a64f93cfc7.zip
c08 strdup malloc + 1 for \0, c09 begin
Diffstat (limited to 'c08/main.c')
-rw-r--r--c08/main.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/c08/main.c b/c08/main.c
index 67a40dc..c2a6dda 100644
--- a/c08/main.c
+++ b/c08/main.c
@@ -6,7 +6,7 @@
/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/12 15:24:19 by cacharle #+# #+# */
-/* Updated: 2019/07/13 08:55:06 by cacharle ### ########.fr */
+/* Updated: 2019/07/15 10:11:05 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -27,15 +27,15 @@ int main()
printf("--------------------\n");
char **a = (char**)malloc(sizeof(char*) * 3);
- a[0] = (char*)malloc(sizeof(char) * 32);
- a[1] = (char*)malloc(sizeof(char) * 32);
- a[2] = (char*)malloc(sizeof(char) * 32);
- strcpy(a[0], "binjour");
- strcpy(a[1], "je");
- strcpy(a[2], "suis");
+ a[0] = (char*)malloc(sizeof(char) * 1024);
+ a[1] = (char*)malloc(sizeof(char) * 1024);
+ a[2] = (char*)malloc(sizeof(char) * 1024);
+ strcpy(a[0], "ieSrBXBI5d4rW9O2");
+ strcpy(a[1], "eadLhPjehRMwjqv9JJ7Q0WiLTBoVxsLx");
+ strcpy(a[2], "MKynFC5rJwCJ0jdD");
t_stock_str *b = ft_strs_to_tab(3, a);
for (int i = 0; b[i].str != 0; i++)
- printf("%s | %s | %d\n", b[i].str, b[i].copy, b[i].size);
+ printf("%s \n%s | %d\n", b[i].str, b[i].copy, b[i].size);
b[0].copy = "bafj";
ft_show_tab(b);