Welcome to Piscine Reloaded! This project is a collection of exercises aimed at reinforcing your understanding of C programming basics. Each exercise will help you revisit key concepts such as functions, loops, pointers, and structures.
The Piscine Reloaded revisits many exercises from the C Piscine, and challenges you to complete them from scratch. The main goal is to practice and reinforce concepts without reusing past code, allowing you to develop a deep understanding through repetition and refinement.
- Current Version: 1.2
- Piscine Reloaded
- Project Overview
- Table of Contents
- General Rules
- Exercises
- Exercise 00: Oh yeah, mooore...
- Exercise 01: Z
- Exercise 02: clean
- Exercise 03: find_sh
- Exercise 04: MAC
- Exercise 05: Can you create it?
- Exercise 06: ft_print_alphabet
- Exercise 07: ft_print_numbers
- Exercise 08: ft_is_negative
- Exercise 09: ft_ft
- Exercise 10: ft_swap
- Exercise 11: ft_div_mod
- Exercise 12: ft_iterative_factorial
- Exercise 13: ft_recursive_factorial
- Exercise 14: ft_sqrt
- Exercise 15: ft_putstr
- Exercise 16: ft_strlen
- Exercise 17: ft_strcmp
- Exercise 18: ft_print_params
- Exercise 19: ft_sort_params
- Exercise 20: ft_strdup
- Exercise 21: ft_range
- Exercise 22: ft_abs.h
- Exercise 23: ft_point.h
- Exercise 24: Makefile
- Exercise 25: ft_foreach
- Exercise 26: ft_count_if
- Exercise 27: display_file
- Submission and Peer-Evaluation
- All exercises must be executed according to the turn-in procedures.
- Your solutions will be checked by Moulinette, an automated evaluation tool. Ensure your work passes the norminette check.
- Only use allowed functions, and follow the strict submission format for each exercise.
Here's the complete list for all exercises in the same format:
- Turn-in directory:
ex00/
- Files to turn in:
exo.tar
- Allowed functions: None
Create specific files and directories with predefined file permissions and output using ls -l
. Then, use tar
to package them.
- Turn-in directory:
ex01/
- Files to turn in:
z
- Allowed functions: None
Create a file called z
that returns the character "Z" followed by a newline when used with the cat
command.
- Turn-in directory:
ex02/
- Files to turn in:
clean
- Allowed functions: None
Write a command that searches for and deletes files ending with ~
or surrounded by #
in the current directory and subdirectories.
- Turn-in directory:
ex03/
- Files to turn in:
find_sh.sh
- Allowed functions: None
Write a script that searches for all filenames ending with .sh
in the current directory and subdirectories, displaying the filenames without the .sh
extension.
- Turn-in directory:
ex04/
- Files to turn in:
MAC.sh
- Allowed functions: None
Write a script that displays your machine's MAC address followed by a newline.
- Turn-in directory:
ex05/
- Files to turn in:
"\?$*'MaRViN'*$?"
- Allowed functions: None
Create a file with the content "42" and nothing else. The filename must be exactly: \?$*'MaRViN'*$?
.
- Turn-in directory:
ex06/
- Files to turn in:
ft_print_alphabet.c
- Allowed functions:
ft_putchar
Create a function that prints the alphabet in lowercase, in ascending order, on a single line.
- Turn-in directory:
ex07/
- Files to turn in:
ft_print_numbers.c
- Allowed functions:
ft_putchar
Create a function that prints all digits (0-9) in ascending order on a single line.
- Turn-in directory:
ex08/
- Files to turn in:
ft_is_negative.c
- Allowed functions:
ft_putchar
Create a function that displays 'N' if the number passed as a parameter is negative and 'P' if it is positive or zero.
- Turn-in directory:
ex09/
- Files to turn in:
ft_ft.c
- Allowed functions: None
Create a function that takes a pointer to an integer as a parameter and sets its value to 42.
- Turn-in directory:
ex10/
- Files to turn in:
ft_swap.c
- Allowed functions: None
Create a function that swaps the values of two integers passed by address.
- Turn-in directory:
ex11/
- Files to turn in:
ft_div_mod.c
- Allowed functions: None
Create a function that divides two integers and stores the quotient in one pointer and the remainder in another.
- Turn-in directory:
ex12/
- Files to turn in:
ft_iterative_factorial.c
- Allowed functions: None
Create an iterative function that calculates and returns the factorial of the given number. Return 0 in case of an error.
- Turn-in directory:
ex13/
- Files to turn in:
ft_recursive_factorial.c
- Allowed functions: None
Create a recursive function that calculates and returns the factorial of the given number. Return 0 in case of an error.
- Turn-in directory:
ex14/
- Files to turn in:
ft_sqrt.c
- Allowed functions: None
Create a function that returns the square root of a number if it has an integer square root, otherwise return 0.
- Turn-in directory:
ex15/
- Files to turn in:
ft_putstr.c
- Allowed functions:
ft_putchar
Create a function that prints a string to the standard output.
- Turn-in directory:
ex16/
- Files to turn in:
ft_strlen.c
- Allowed functions: None
Recreate the behavior of the strlen
function that returns the length of a string.
- Turn-in directory:
ex17/
- Files to turn in:
ft_strcmp.c
- Allowed functions: None
Recreate the behavior of the strcmp
function that compares two strings lexicographically.
- Turn-in directory:
ex18/
- Files to turn in:
ft_print_params.c
- Allowed functions:
ft_putchar
Create a program that prints all the arguments passed to it.
- Turn-in directory:
ex19/
- Files to turn in:
ft_sort_params.c
- Allowed functions:
ft_putchar
Create a program that prints all the arguments passed to it in ASCII-sorted order, except the first one (program name).
- Turn-in directory:
ex20/
- Files to turn in:
ft_strdup.c
- Allowed functions:
malloc
Recreate the behavior of the strdup
function which duplicates a string using dynamic memory allocation.
- Turn-in directory:
ex21/
- Files to turn in:
ft_range.c
- Allowed functions:
malloc
Create a function that returns an array of integers ranging from min
to max
(excluding max). If min
is greater than or equal to max
, return NULL
.
- Turn-in directory:
ex22/
- Files to turn in:
ft_abs.h
- Allowed functions: None
Create a macro ABS
that computes the absolute value of its argument.
- Turn-in directory:
ex23/
- Files to turn in:
ft_point.h
- Allowed functions: None
Create a header file ft_point.h
containing the definition of a struct t_point
with two integer members x
and y
.
- Turn-in directory:
ex24/
- Files to turn in:
Makefile
- Allowed functions: None
Create a Makefile
to compile the library libft.a
. The Makefile
should handle the rules: all
, clean
, fclean
, and re
.
- Turn-in directory:
ex25/
- Files to turn in:
ft_foreach.c
- Allowed functions: None
Create a function ft_foreach
that applies a function to each element of an integer array.
- Turn-in directory:
ex26/
- Files to turn in:
ft_count_if.c
- Allowed functions: None
Create a function ft_count_if
that returns the number of strings in the array that return 1 when passed to the function f
.
- Turn-in directory:
ex27/
- Files to turn in:
Makefile
and necessary program files - Allowed functions:
open
,read
,write
,close
Create a program ft_display_file
that displays the contents of a file passed as an argument. It must handle errors such as missing or too many arguments.
This should cover all exercises. Let me know if you need further adjustments or help!
- All exercises must be submitted through your Git repository.
- Ensure file and folder names are accurate, as only the content inside your repository will be evaluated during the defense.
- Double-check your work against the submission requirements to avoid any errors.
Happy coding, and good luck with the exercises!