42 Exam 05 -

"Exam 05 took me three tries. The first time, I didn't even know what a semaphore was. The second time, I deadlocked in the first 30 minutes. The third time, I practiced the Dining Philosophers for a week straight and finished with an hour to spare."Anonymous 42 alum

"The trick to 42 exam 05 is to internalize the difference between a mutex and a semaphore. A mutex is a toilet lock (one person at a time). A semaphore is a parking garage (max N cars). Once you see that, everything clicks."Peer tutor from 42 Paris 42 exam 05

The last part of the exam usually asks for an Intern class. The Intern has a makeForm() function that returns a pointer to a new Form based on a string name. Pro tip: Use an array of function pointers or a map of strings to avoid a 100-line if/else if nightmare. Keep it clean. If the Intern doesn't know the form, return NULL (nullptr). "Exam 05 took me three tries

Typical Exercise: sorted_list_merge or ft_list_remove_if "The trick to 42 exam 05 is to