Exam 01 Piscine 42 Guide
Exam 01 of the 42 Piscine is generally considered a "reality check" for participants. While the first exam (Exam 00) is often a baseline, Exam 01 introduces higher complexity and tests whether you have truly mastered the basics of C programming and memory management. Core Focus Areas Fundamental C Logic : You must be able to write basic loops ( ) and conditional statements ( ) instinctively without reference materials. Pointers and Memory
: This exam typically starts testing your understanding of pointers and address manipulation, which are common hurdles for beginners. String Manipulation : Be prepared to recreate basic functions like from scratch. Norminette Compliance
: Your code must strictly follow the school's coding standards (the "Norm"), or it will fail automatically. Key Challenges Strict Grading Exam 01 Piscine 42
: If your first exercise fails, the entire exam ends immediately for you (the "fail-fast" system). Every semicolon and space must be perfect. Time Pressure
: The exam environment is isolated, often lasting several hours, which can cause significant stress even if the logic seems simple. Automated Correction Exam 01 of the 42 Piscine is generally
: Your work is corrected by a program (often called "Moulinette"), meaning there is zero room for negotiation on errors like "too many bytes allocated" or missing files. Recommended Study Resources
ayoub0x1/C-Piscine-exam: Get ready for your 1337 ... - GitHub Common Mistakes That Cause Immediate KO
Common Mistakes That Cause Immediate KO
- Missing Header: Every file must have:
#include <unistd.h> (for write) or #include <stdlib.h> (for malloc). Forgetting this is an instant KO.
- Function Name Typo: The prompt says
ft_putstr. You write ft_putstrr. Moulinette does not guess.
- Unused Variables: The Norm forbids unused variables. Remove them.
- Segfaults: If your program crashes, the grader stops. Always check for
NULL returns from malloc.
- Leaks (Experimental): Some exams now have a memory leak checker. If you
malloc and don't free, you might pass functionality but fail the "Leak" test.
The "Norm" Nightmare: Why Your Code Fails Even When It Works
The most frustrating part of Exam 01 is The Norminette. 42 has a strict coding standard (The Norm).
- No more than 25 lines per function.
- No more than 4 parameters.
- No
for loops (you must use while).
- No more than 5 variables per function.
- No
printf, no malloc (unless the exercise explicitly allows it).
If your code solves the problem perfectly but has 26 lines, or uses a for loop, the Moulinette will mark it KO (Norme Error).
Pro Tip: Before you upload your ex01/ folder, run norminette -R CheckForbiddenSourceHeader . in your terminal. If it yells, fix it.
Write-Up: Exam 01 – 42 Piscine
3. String Manipulation (Without <string.h>)
You will be required to re-implement core string functions:
ft_strlen – The absolute first function of the Piscine. Count characters until \0.
ft_strcpy / ft_strncpy – Copy strings.
ft_strcmp – Compare two strings lexicographically.
ft_strrev – Reverse a string in place.
2. Start with the easiest exercise regardless of points
Some students waste time on a level 03 they can't solve → missing easy points from level 00–01.