Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Thitiwut Somsa committed Dec 18, 2021
1 parent b387e02 commit a6d9260
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 59 deletions.
17 changes: 0 additions & 17 deletions c00/ex00/ft_putchar.c

This file was deleted.

16 changes: 0 additions & 16 deletions c01/ex00/ft_ft.c

This file was deleted.

26 changes: 0 additions & 26 deletions c02/ex07/\

This file was deleted.

1 change: 1 addition & 0 deletions c06
Submodule c06 added at 759d6f
18 changes: 18 additions & 0 deletions check_c07/ex00/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <stdio.h>

char *ft_strdup(char *src);

int main(void)
{
char *s;

printf("Expect.\n");
printf("Test text.bad.\n");
printf("Test text.\n");
printf("Result.\n");
s = ft_strdup("Test text.bad.");
printf("%s\n",s);
s[10] = 0;
printf("%s\n",s);
}

15 changes: 15 additions & 0 deletions check_c07/ex01/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdio.h>

int *ft_range(int min, int max);

int main(void)
{
int *a;
int *b;

a = ft_range(5,5);
b = ft_range(5,9);
printf("Expect.0x0 5 6 7 8\n");
printf("Result.%p %d %d %d %d\n",a,b[0],b[1],b[2],b[3]);
}

17 changes: 17 additions & 0 deletions check_c07/ex02/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>

int ft_ultimate_range(int **range, int min, int max);

int main(void)
{
int *a;
int *b;
int c;
int d;

c = ft_ultimate_range(&a,5,5);
d = ft_ultimate_range(&b,5,9);
printf("Expect.0 4 0x0 5 6 7 8\n");
printf("Result.%d %d %p %d %d %d %d\n",c,d,a,b[0],b[1],b[2],b[3]);
}

28 changes: 28 additions & 0 deletions check_c07/ex03/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>

char *ft_strjoin(int size, char **strs, char *sep);

int main(int argc, char **argv)
{
char *strs[10];
char *str;
int i;

strs[0] = "abc";
strs[1] = "def";
strs[2] = "";
strs[3] = "m";
strs[4] = "badfsfsaf";

i = 3;
if (argc>1)
{
i = argv[1][0] - '0';
}

str = ft_strjoin(i,strs, " x ");
printf("%s\n",str);
free(str);
return 0;
}
11 changes: 11 additions & 0 deletions check_c07/ex04/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <stdio.h>

char *ft_convert_base(char *nbr, char *base_from, char *base_to);

int main(void)
{
char *str;

str = ft_convert_base("5647","0123456789","0123456789ABCDEF");
printf("%s\n",str);
}
15 changes: 15 additions & 0 deletions check_c07/ex05/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdio.h>

char **ft_split(char *str, char *charset);

int main(void)
{
char **strs;

strs = ft_split("fsasfadsfsdfsbcxbcxbcxbbb", "abc");

int i=0;
while (strs[i])
printf("%s\n",strs[i++]);
return (0);
}
7 changes: 7 additions & 0 deletions check_c07/gccmain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if [ -f "a.out" ] ; then
rm a.out
fi
Norminette -R CheckForbiddenSourceHeader $1 $2
gcc -Wall -Wextra -Werror $1 $2 main.c
./a.out | cat -e

0 comments on commit a6d9260

Please sign in to comment.