diff --git a/42-Docs/Data Structures/C-Structures.pdf b/42-Docs/Data Structures/C-Structures.pdf new file mode 100644 index 0000000..cc638a0 Binary files /dev/null and b/42-Docs/Data Structures/C-Structures.pdf differ diff --git a/Data Structures/C-Strings/ex2/ft_strcmp.c b/Data Structures/C-Strings/ex2/ft_strcmp.c index 0dd3bbf..a344ed9 100644 --- a/Data Structures/C-Strings/ex2/ft_strcmp.c +++ b/Data Structures/C-Strings/ex2/ft_strcmp.c @@ -6,7 +6,7 @@ /* By: lclerel- +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/03/24 13:44:05 by lclerel- #+# #+# */ -/* Updated: 2026/03/24 15:55:22 by lclerel- ### ########.fr */ +/* Updated: 2026/03/25 16:39:44 by lclerel- ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,11 +17,11 @@ int ft_strcmp(char *s1, char *s2) int i; i = 0; - while (s1[i] != '\0' && s1[i] == s2[i]) + while ((s1[i] || s2[i]) && s1[i] == s2[i]) i++; return ((unsigned char)s1[i] - (unsigned char)s2[i]); } -/* + void ft_putchar(char chara) { write(1, &chara, 1); @@ -38,7 +38,7 @@ void ft_putstr(char *str) i++; } } - +/* int main(void) { char *s1 = "Lumi"; @@ -80,4 +80,5 @@ int main(void) write(1, "Test 3 : Not OK :(", 18); ft_putchar('\n'); return (0); -}*/ +} +*/ \ No newline at end of file diff --git a/Data Structures/C-Strings/ex3/ft_strncmp.c b/Data Structures/C-Strings/ex3/ft_strncmp.c index 7d761a7..bc2595a 100644 --- a/Data Structures/C-Strings/ex3/ft_strncmp.c +++ b/Data Structures/C-Strings/ex3/ft_strncmp.c @@ -6,10 +6,10 @@ /* By: lclerel- +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/03/24 13:44:05 by lclerel- #+# #+# */ -/* Updated: 2026/03/24 15:55:40 by lclerel- ### ########.fr */ +/* Updated: 2026/03/25 16:39:14 by lclerel- ### ########.fr */ /* */ /* ************************************************************************** */ -#include + int ft_strncmp(char *s1, char *s2, unsigned int n) { @@ -18,7 +18,7 @@ int ft_strncmp(char *s1, char *s2, unsigned int n) i = 0; if (n == 0) return (0); - while (s1[i] != '\0' && s1[i] == s2[i] && i < n - 1) + while ((s1[i] || s2[i]) && s1[i] == s2[i] && i < n - 1) i++; return ((unsigned char)s1[i] - (unsigned char)s2[i]); } diff --git a/README.md b/README.md index a5444fc..0f4303e 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,8 @@ Voici l'historique de mes validations. Chaque "Attempt" représente une étape d | Projet | Tentatives | Statut | Date Début/Fin | | :--- | :--- | :--- | :--- | -| **[C Strings](./Data%20Structures/C-Strings) | [En Cours] | ⏳ | 23/03/2026 20h21 - ??? | +| **[C Strings](./Data%20Structures/C-Strings)** | [En Cours] | ⏳ | 23/03/2026 20h21 - ??? | +| **[C Structures](./Data%20Structures/C-Structures)** | [En Cours] | ⏳ | 25/03/2026 16h12 - ??? | ## 📝 Mes Examens | Examen | Score | Résultat | Raison |