small changes to mains

This commit is contained in:
Aleksei Chubukov 2023-11-23 01:34:57 +04:00
parent d75ddf60ed
commit b34fd5e7e2
7 changed files with 34 additions and 31 deletions

View File

@ -7,18 +7,19 @@ empty:=
space:= $(empty) $(empty) space:= $(empty) $(empty)
CFLAGS_MANDATORY := -Wall -Wextra -Werror CFLAGS_MANDATORY := -Wall -Wextra -Werror
all_builds := $(foreach e, 00 01 02 03 04 05 06 07 08, build/c00/ex$e) \ all_builds := $(foreach e, 00 01 02 03 04 05 06 07 08, build/c00/ex$e) \
$(foreach e, 00 01 02 03 04 05 06 07 08, build/c01/ex$e) $(foreach e, 00 01 02 03 04 05 06 07 08, build/c01/ex$e) \
$(foreach e, 00 01 02 03 04 05 06 07 08 09 10 11 12, build/c02/ex$e) \
all: norme $(all_builds) all: norme $(all_builds)
build: build:
mkdir $@ mkdir $@
clean: clean:
rm -rf build rm -rf build
.PHONY: all norme clean
.SECONDEXPANSION: .SECONDEXPANSION:
build/c%: $(OFFSHORE_PROJECTS)/c$$(subst _,+,$$*)/*.c $$(OFFSHORE_MAINS)/c$$*.c build/c%: $(OFFSHORE_PROJECTS)/c$$*/*.c $$(OFFSHORE_MAINS)/c$$*.c
mkdir -p $(@D) mkdir -p $(@D)
$(CC) -o $@ $(CFLAGS_MANDATORY) $(CFLAGS) $^ $(CC) -o $@ $(CFLAGS_MANDATORY) $(CFLAGS) $^
norme: $$(wildcard $(OFFSHORE_PROJECTS)/c*) norme: $$(wildcard $(OFFSHORE_PROJECTS)/c*)
norminette -R CheckForbiddenSourceHeader $^ norminette -R CheckForbiddenSourceHeader $^
.PHONY: all norme clean

View File

@ -6,13 +6,19 @@
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */ /* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/18 19:43:15 by achubuko #+# #+# */ /* Created: 2023/11/18 19:43:15 by achubuko #+# #+# */
/* Updated: 2023/11/18 19:52:46 by achubuko ### ########.fr */ /* Updated: 2023/11/23 01:00:45 by achubuko ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include <stdio.h>
void ft_putchar(char c); void ft_putchar(char c);
int main() int main()
{ {
ft_putchar('0'); printf("Hello\n");
ft_putchar('H');
ft_putchar('e');
ft_putchar('l');
ft_putchar('l');
ft_putchar('o');
ft_putchar('\n');
} }

View File

@ -6,13 +6,16 @@
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */ /* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/18 20:31:16 by achubuko #+# #+# */ /* Created: 2023/11/18 20:31:16 by achubuko #+# #+# */
/* Updated: 2023/11/18 20:46:04 by achubuko ### ########.fr */ /* Updated: 2023/11/23 01:08:00 by achubuko ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include <unistd.h>
void ft_print_alphabet(void); void ft_print_alphabet(void);
int main(void) int main(void)
{ {
write(1, "abcdefghijklmnopqrstuvwxyz%\n", 28);
ft_print_alphabet(); ft_print_alphabet();
write(1,"%\n", 2);
return 0; return 0;
} }

View File

@ -1,18 +1,10 @@
/* ************************************************************************** */ #include <unistd.h>
/* */
/* ::: :::::::: */
/* c00_ex01.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/18 20:31:16 by achubuko #+# #+# */
/* Updated: 2023/11/18 22:07:50 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
void ft_print_reverse_alphabet(void); void ft_print_reverse_alphabet(void);
int main(void) int main(void)
{ {
write(1, "zyxwvutsrqponmlkjihgfedcba%\n", 28);
ft_print_reverse_alphabet(); ft_print_reverse_alphabet();
write(1, "%\n", 2);
return 0; return 0;
} }

View File

@ -1,18 +1,10 @@
/* ************************************************************************** */ #include <unistd.h>
/* */
/* ::: :::::::: */
/* c00_ex01.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/18 20:31:16 by achubuko #+# #+# */
/* Updated: 2023/11/18 22:24:47 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
void ft_print_numbers(void); void ft_print_numbers(void);
int main(void) int main(void)
{ {
write(1, "0123456789%\n", 12);
ft_print_numbers(); ft_print_numbers();
write(1, "%\n", 2);
return 0; return 0;
} }

View File

@ -15,7 +15,7 @@ void ft_sort_int_tab(int *tab, int size);
int main(void) int main(void)
{ {
int l = 21; int l = 21;
int a[21] = {4864, 3701, 20180, 26376, 32663, 15756, 18510, 1899, 9799, 13343, 25186, 7746, 8528, 7746, 11579, 4635, 25883, 23006, 3988, 21611, 26591}; int a[21] = {4864, 3701, 20180, -26376, 32663, 15756, -18510, -1899, 9799, 13343, -25186, 7746, 8528, 7746, 11579, 4635, 25883, 23006, 3988, 21611, 26591};
printarr(a, l); printarr(a, l);
ft_sort_int_tab(a, l); ft_sort_int_tab(a, l);
printarr(a, l); printarr(a, l);

9
c02/ex00.c Normal file
View File

@ -0,0 +1,9 @@
char *ft_strcpy(char *dest, char *src);
int main(void)
{
char s[100] = "hello";
char d[100] = "goodbye";
ft_strcpy(s, d);
}