Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
4

42_CheatSheet

> 编程语言
Open source

A comprehensive guide to 50 years of evolution of strict C programming, a tribute to Dennis Ritchie's language

2.0K stars0 likes2 views
WebsiteGitHub

About

A comprehensive guide to 50 years of evolution of strict C programming, a tribute to Dennis Ritchie's language

42 School Cheat Sheet by agavrel

Language / 언어: English (this document) · 한국어 (Korean)

:two_hearts: Intended for 42 alumni, current students and candidates

Truth can only be found in one place: the code – Robert C. Martin, Clean Code: A Handbook of Agile Software Craftsmanship

A comprehensive guide to 50 years of evolution of strict C programming, a tribute to Dennis Ritchie's language


Table of Content

  • 0. About 42 School
    • 0x00 ~ What is 42 School
    • 0x01 ~ For Candidates: About the "Piscine"
      • My guess on the success criteria
      • List of Essential Items
    • 0x02 ~ Coding simple C programs
      • First by installing a C compiler on your computer
      • C Data Types
      • Pointers
      • ft_putchar
      • ft_strlen
      • ft_putstr
    • 0x03 ~ 42 Projects Guides
    • 0x04 ~ Choosing your Path
    • 0x05 ~ Swindle the norminette - truander la norme
      • While Loops
      • If Brackets
      • Write Colorful Usage
      • Function Pointers
    • 0x06 ~ Impossible is not C

  • 1. Common Beginner Mistakes
    • 0x00 ~ Array Overflow
    • 0x01 ~ Segmentation Fault
    • 0x02 ~ Bus error
    • 0x03 ~ Stack smashing
    • 0x04 ~ Modifying value of a local variable given as function parameter
    • 0x05 ~ Unprotected Malloc
    • 0x06 ~ Freeing memory that has already been fred
    • 0x07 ~ Do Not Use Global Variables
    • 0x08 ~ Variable Length Arrays
    • 0x09 ~ Using ft_ prefix for all functions
    • 0x0A ~ Usage of Sequence Point
    • 0x0B ~ Assignment of read-only location
    • 0x0C ~ Carefully use define preprocessor macros
    • 0x0D ~ Comparing Float and Double
    • 0x0E ~ Wrong usage of pointers
    • 0x0F ~ Undefined Behavior
    • 0x10 ~ Operator Precedence

  • 2. Clean Code
    • 0x00 ~ Meaningful and Explicit Names
    • 0x01 ~ Write short functions
    • 0x02 ~ Using structure for basic items
    • 0x03 ~ Using flags for projects' options
    • 0x04 ~ Using gcc flags for Makefile
    • 0x05 ~ Using preprocessor DEBUG macros
    • 0x06 ~ Branching Optimization
    • 0x07 ~ Reserved Keywords

  • 3. Programmer Tools
    • 0x00 ~ Code Editors
    • 0x01 ~ Terminal Bash
    • 0x02 ~ Git
    • 0x03 ~ Productivity Gains
    • 0x04 ~ Add a a new binary in the PATH environment variable
    • 0x05 ~ Computer Graphics Libraries

  • 4. Curated list of Programming Learning Materials
    • 0x00 ~ C Knowledge
    • 0x01 ~ Algorithm
    • 0x02 ~ Bitwise Manipulations
    • 0x03 ~ Network
    • 0x04 ~ Hacking & Security
    • 0x05 ~ Computer Graphics
    • 0x06 ~ Computer Vision & AI
    • 0x07 ~ C++ Optimization
    • 0x08 ~ Assembly Optimization
    • 0x09 ~ Functional Programing
    • 0x0A ~ Computer Architecture
    • 0x0B ~ Misc
    • 0x0C ~ Science-Fictions Masterpieces

  • 5. Tutorials
    • 0x00 ~ Optimization - Aiming for the lowest latency
      • Optimization flags
      • Multithreading and Parallelization
      • Vectorization
      • Combining Optimization Flags, Parallelization and Vectorization
      • The right algorithm
      • Exploring Compiler's Assembly Output
    • 0x01 ~ Computer Graphics - Using SDL2 to create Fractal
      • Using SDL2 to create Computer Graphics
      • Example with a Barnsley Fern Fractal
    • 0x02 ~ Hacking - Buffer Overflow
      • Introduction
      • Buffer overflow to hijack a password
      • Shellcode Execution to get root access

  • 6. Epilogue
    • 0x00 ~ Wanted PR
    • 0x01 ~ Question ? Broken Link ? Wanna contribute ?
    • 0x02 ~ Liked it ?
    • 0x2A ~ About the Author

NB: Use CTRL + F or Command + F to quickly look for keywords.


About 42 School


0x00 ~ What is 42 School

42 is more than just a disruptive educational model and coding school. What makes us unique and a major player in the tech world are the defining characteristics of the 42 culture. Every element of 42 shows our culture, from the students, to the curriculum structure and content, to the $0 tuition and innovative admissions process.

That's right, the school is FREE, originally funded and founded in Paris by generous philanthropist billionaire Xaviel Niel.

I'm not unusual; it's the others who are strange ― Xavier Niel

The name of the school, "42", is a tribute to The Hitchhiker's Guide to the Galaxy, a comedy science fiction series created by Douglas Adams.

42, or The Answer to the Ultimate Question of Life, The Universe, and Everything

The supercomputer had this function ready:

c
#include <stdio.h>

#define true  1
#define false 0

int what_is_forty_two(void) {
    int n = true << 1 | false; // n = 0b10;
    while (__builtin_popcount(n) != 3) // stop when reaching 3 bits set
        n |= n << 2;  // n adds two empty bits with << 2 (x4) and add itself with |
    return (++n == '*') ? n : !!n * (n - 1); // you may simply return n;
}

int main(void) {
    char *question = "What is the answer to Life, the Universe and Everything?\n";
    printf("%sDeep Thought: %d\n", question, what_is_forty_two()); // %s print a string, and %d an integer
    return 0;
}

There are no teachers but a pedagogic team that ensure that students do not harm the material and provide a cursus syllabus to follow. What is learned is hence mainly achieved through peer-to-peer project review and RTFM.

Most of the entrance exam and early cursus is done in C language.

Nevertheless, C retains the basic philosophy that programmers know what they are doing; it only requires that they state their intentions explicitly. ― Brian W. Kernighan, The C Programming Language

C is the most pedagogic programming language you can learn as it allows to understand the basis of programming from simple concepts like conditions {if, elseif, else}, loops {while, do while, for}, write system calls and pointers to more advanced one like function pointers and memory allocation.

Later on you can specialize in other languages: Python will fit data scientists and devops, javascript for frontend developers and C# for those looking for a career in finance.

When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, for free.' ― Linus Torvalds

You will learn how to do what Muggles were only able to do accidentally.


0x01 ~ For Candidates: About the "Piscine"

If you're going through hell, keep going. ― Winston Churchill

The piscine is the entrance exam that consists of 4 weeks fully dedicated to coding, solving exercises and submitting solo and group projects to peer review.

It does not matter if you fail a project, an exam or a day as long as you keep striving. Someone who has never been interested before in Computer Science would never be able to complete everything in time, yet he will not prevent from being successful.

:coffee: My guess on the success criteria

  • 0x00 Come as you are ... or forget this bullshit and prepare a little bit with subjects on github, courtesy of my friend binary hacker.

  • 0x01 Prepare to nail the exams on the 4 exams session, knowing that the 3 firsts exams are limited in term of how far you can go and it is not a big deal to miss the first 3 exams as the most important is IMHO the maximum level you can reach. Succeeding the first 4 exercises (36 pts) should be enough to make sure you quality.

  • 0x02 Get an acceptable percentage of review from peers (probably 80% is enough, but you would get 90 to 97% if you are nice). Don't be too nice, but don't be a dick with vim .swp files and .DS_Store.

.DS_Store – The name of a file in the Apple OS X operating system for storing custom attributes of a folder such as the position of icons or the choice of a background image. These files are created when you manipulate your files with the Finder GUI.

  • 0x03 The logging time has no or very little influence, I know it as a fact for seeing people constantly logged in (but slacking) failing the piscine

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C4242born2code42fremont42madrid

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言