Get the latest news from your city

Download

C Piscine Exam 01 Site

Arrays are collections of elements of the same data type stored in contiguous memory locations.

Strings are arrays of characters.

Example:

int scores[5] = 90, 80, 70, 60, 50;  // array declaration
char name[] = "John";  // string declaration
printf("Score 1: %d\n", scores[0]);  // array indexing
printf("Name: %s\n", name);  // string operation

Convert a string (in a given numeric base, e.g., binary, hex) into an integer. This requires handling +/- signs, whitespace, and invalid characters. It is the ultimate test of string traversal. c piscine exam 01

Why it's hard: You have to track sign, manage overflow (informally), and validate the base string (no duplicates, no +/-).

Computers store int 1 differently from char '1'.

The most iconic function of Exam 01 is ft_swap. Arrays are collections of elements of the same

A student who fails this function has not yet understood the Piscine. A student who passes has unlocked a fundamental truth: To change a variable outside your function, you need its address. Without a temporary variable and careful dereferencing (*a, *b), the code fails silently, and the Norminette (the 42 style checker) will devour your soul if your indentation is off.

In C, a variable is a name given to a memory location that stores a value. C has various data types, including:

Example:

int x = 5;  // integer variable
char c = 'A';  // character variable
float pi = 3.14;  // floating point variable

"I failed Exam 01 the first time. I got a 0 because my ft_strdup had an off-by-one. I went to the retake session three days later, practiced ft_split for 12 hours straight, and passed. That failure was the best lesson I ever had." – 42 Alumnus

"Exam 01 is where half my friend group dropped out. Not because they weren't smart, but because they never practiced under time pressure. If you can't write ft_atoi on a whiteboard in 10 minutes, you aren't ready." – Current Peer Tutor