Skip to content

Commit

Permalink
:cog: Fixed norminette
Browse files Browse the repository at this point in the history
  • Loading branch information
IanToujou committed Oct 16, 2024
1 parent d1e4ff8 commit 980ff89
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 27 deletions.
5 changes: 3 additions & 2 deletions Piscine-Reloaded/ex12/ft_iterative_factorial.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@

int ft_iterative_factorial(int nb)
{
int result;
int result;

if (nb < 0)
return (0);
result = 1;
while (nb > 0) {
while (nb > 0)
{
result *= nb;
nb--;
}
Expand Down
2 changes: 1 addition & 1 deletion Piscine-Reloaded/ex17/ft_strcmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ int ft_strcmp(char *s1, char *s2)
s2++;
}
return (*s1 - *s2);
}
}
7 changes: 4 additions & 3 deletions Piscine-Reloaded/ex18/ft_print_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ void ft_putstr(char *str)
ft_putchar(*str++);
}

int main(int argc, char **argv)
int main(int argc, char **argv)
{
int i;

i = 1;
while (i < argc) {
while (i < argc)
{
ft_putstr(argv[i]);
ft_putchar('\n');
i++;
}
}
}
27 changes: 13 additions & 14 deletions Piscine-Reloaded/ex19/ft_sort_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@
#include <stdbool.h>
#include <unistd.h>

void ft_putchar(char c)
{
write(1, &c, 1);
}

void ft_putstr(char *str)
{
while (*str) {
ft_putchar(*str);
while (*str)
{
write(1, str, 1);
str++;
}
}
Expand Down Expand Up @@ -50,18 +46,21 @@ void ft_sort(char **array, int size, int offset)
int i;
bool swapped;

while(true) {
while (true)
{
i = offset;
swapped = false;
while (i < size) {
if(ft_strcmp(array[i], array[i+1]) > 0) {
ft_swap(&array[i], &array[i+1]);
while (i < size)
{
if (ft_strcmp(array[i], array[i + 1]) > 0)
{
ft_swap(&array[i], &array[i + 1]);
swapped = true;
}
i++;
}
if (!swapped)
break;
break ;
}
}

Expand All @@ -70,12 +69,12 @@ int main(int argc, char **argv)
int i;

if (argc > 2)
ft_sort(argv, argc-1, 1);
ft_sort(argv, argc - 1, 1);
i = 1;
while (i < argc)
{
ft_putstr(argv[i]);
ft_putchar('\n');
ft_putstr("\n");
i++;
}
}
5 changes: 3 additions & 2 deletions Piscine-Reloaded/ex21/ft_range.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ int *ft_range(int min, int max)
if (!result)
return (NULL);
i = 0;
while (min+i < max) {
result[i] = min+i;
while (min + i < max)
{
result[i] = min + i;
i++;
}
return (result);
Expand Down
2 changes: 1 addition & 1 deletion Piscine-Reloaded/ex22/ft_abs.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
#ifndef FT_ABS_H

# define FT_ABS_H
# define ABS(Value) ((Value < 0) ? -Value : Value)
# define ABS(Value) (((Value) < 0) ? -(Value) : (Value))

#endif
3 changes: 2 additions & 1 deletion Piscine-Reloaded/ex23/ft_point.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

# define FT_POINT_H

typedef struct s_point {
typedef struct s_point
{
int x;
int y;
} t_point;
Expand Down
5 changes: 3 additions & 2 deletions Piscine-Reloaded/ex25/ft_foreach.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@

void ft_foreach(int *tab, int length, void (*f)(int))
{
int i;
int i;

i = 0;
while (i < length) {
while (i < length)
{
(*f)(tab[i]);
i++;
}
Expand Down
2 changes: 1 addition & 1 deletion Piscine-Reloaded/ex26/ft_count_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

int ft_count_if(char **tab, int (*f)(char *))
{
int count;
int count;
int i;

count = 0;
Expand Down

0 comments on commit 980ff89

Please sign in to comment.