Warning: Spoiler ahead for the most common Level 1 exercise.
The goal is to print characters shared between two strings. The logic requires a helper function to check two things:
#include <unistd.h>
// Helper to check if char exists in string
int check(char *str, char c, int index)
int i = 0;
while (i < index)
if (str[i] == c)
return (1); // Found duplicate
i++;
return (0); // No duplicate
void inter(char *s1, char *s2)
int i = 0;
int j;
while (s1[i])
// Check if s1[i] is in s2 AND not seen before in s1
j = 0;
while (s2[j])
if (s1[i] == s2[j])
if (!check(s1, s1[i], i))
write(1, &s1[i], 1);
break; // Stop checking s2 once found
j++;
i++;
Search on GitHub with these queries:
"exam rank 02" 42
or
"rank 02" exam 42
Some popular repos:
Also check the 42 Born2Code or 42-Cursus repositories.
Task: Write a function that displays a string on the standard output.
Forbidden: printf, puts.
Code Logic: (You must use the write system call). exam rank 02 github
#include <unistd.h>
void ft_putstr(char *str) int i = 0; while (str[i]) write(1, &str[i], 1); i++;
Before you type git clone, you must understand the enemy. Warning: Spoiler ahead for the most common Level 1 exercise
Exam Rank 02 is a 4-hour, solo, offline exam that tests your ability to write small C programs from scratch. You are given a random level (from 0 to 4) based on your previous successes. The rules are brutal:
If you fail, you must wait to retry. Many students get stuck here for months.