C

@cstuny

24.02 révision ft_list_remove_if version courte

C
1 year ago
#include <stdio.h> typedef struct s_list { struct s_list *next; void *data; } t_list; #include <stdio.h> // pour printf //#include "ft_list.h"

24.02. revision permutation

C
1 year ago
#include <stdlib.h> #include <unistd.h> #include <stdio.h> // pour printf uniquement void print_string(char *str) { while (*str) write(1, str++, 1); write(1, "\n", 1);

24.02. revision sort_list ok fonctionne

C
1 year ago
#include <stdio.h> #include <stdlib.h> //#include "list.h" typedef struct s_list { int data; struct s_list *next; } t_list;

24.02 revision sort int_tab

C
1 year ago
#include <stdio.h> void swap(int *a, int *b) { int tmp; tmp = *a; *a = *b; *b = tmp; }

24.02 revision ft_list_foreach

C
1 year ago
#include <stdio.h> // pas besoin #include <stdlib.h> // ne pas oublier // #include "ft_list.h" // (*f)(list_ptr->data); typedef struct s_list { struct s_list *next; void *data;

24.02 split revision a tester

C
1 year ago
#include <stdio.h> #include <stdlib.h> int count_w(char *s) { int wc = 0; int in_word = 0; // Indicateur si on est dans un mot while (*s) {

24.02 itoa test revision

C
1 year ago
/* but: transformer un nbr int en une chaine de caractère il faut gérer: - calculer la longueur (nbr de caractère du int avec y inclure le signe -) - malloc une chaine avec len + 1 - ensuite on va écrire depuis derrère car utilise % enleve le bout - mettre le \0 en postion len - gérer le signe: si nég transformer en postif et écrie - en postion 0 - si 0 alors écrire le 0 en postion 0 et return car fini - pour les autre nombre: --len (pour sauter écrire le pre

sort_list

C
1 year ago
#include <stdlib.h> #include "list.h" void ft_swap(int *a, int *b) { int tmp; tmp = *a; *a = *b; *b = tmp;

ft_list_foreach

C
1 year ago
#include "ft_list.h" void ft_list_foreach(t_list *begin_list, void (*f)(void *)) { t_list *current; current = begin_list; while (current) { (*f)(current->data);

ft_list_remove_if

C
1 year ago
/* #ifndef FT_LIST_H # define FT_LIST_H typedef struct s_list { struct s_list *next; void *data; } t_list;

ft_split version examen

C
1 year ago
#include <stdlib.h> #include <stdio.h> void free_split(char **split); int count_words(char *s) { int i = 0; int wc = 0;

sort_int_tab

C
1 year ago
void myswap(int *tab, int i); void sort_int_tab(int *tab, unsigned int size); void myswap(int *tab, int i) { int tmp; tmp = tab[i]; tab[i] = tab[i +1]; tab[i + 1] = tmp;

ft_itoa

C
1 year ago
#include <stdlib.h> static int count_char(int n) { int count = 0; if (n <= 0) count = 1; // Pour le '0' ou le signe '-' while (n != 0) {

fprime.c

C
1 year ago
#include <stdio.h> #include <stdlib.h> void print_prime_factors(int n) { if (n == 1) { printf("1"); return ; }

flood_fill.c

C
1 year ago
#include <stdio.h> typedef struct s_point { int x; int y; } t_point; void fill(char **tab, t_point size, t_point current, char to_fill) {

Revision atoi version GIT

C
1 year ago
int ft_atoi(char *str) { int i; int sign; int result; // Initialisation des variables i = 0; // Index pour parcourir la chaîne de caractères sign = 1; // Pour gérer le signe du nombre, initialisé à 1 (positif) result = 0; // Résultat final, initialisé à 0

Revision ft_strrev ma version a voir sur VIM

C
1 year ago
int ft_strlen(char *str) { int len; len = 0; while (*str != '\0') len++; return (len); }

Revision ft_strrev version GIT

C
1 year ago
int ft_strlen(char *str) { int i; i = 0; while (str[i]) i++; return (i); } char *ft_strrev(char *str)

Revision ulstr.c mon programme a refaire!!!

C
1 year ago
#include <stdio.h> #include <unistd.h> void ft_ulstr(char str[]) { int i; i = 0; while (str[i]) {

Revision ulstr.c mon programme Final!!!

C
1 year ago
#include <stdio.h> #include <unistd.h> void ft_putstr(char *str) { while (*str) write(1, str++, 1); } void ft_ulstr(char str[])