42 の C 課題用テンプレートです。
このリポジトリは、C 課題を始めるときの最低限の土台として使うことを想定しています。Makefile と GitHub Actions の雛形を含みますが、各課題の要件を自動で満たすものではありません。
課題要件に README.md の作成や内容指定がある場合は、必ずその課題要件に従って README.md を書いてください。
本テンプレートを使用した結果、レビュー、機械採点、Norminette、提出チェック、その他の評価に通らなかったとしても、テンプレート作成者は一切責任を負いません。提出前の確認責任は、使用者本人にあります。
42 の課題では、ファイル名、ディレクトリ構成、Makefile のターゲット、提出対象、使用可能な関数、禁止事項が課題ごとに異なります。テンプレートをそのまま使わず、必ず subject を読み、課題ごとに調整してください。
- このテンプレートからリポジトリを作成する
- 課題の subject を読む
- 必要なファイルとディレクトリだけを配置する
Makefileを課題要件に合わせて書き換える- ローカルでコンパイル、Norminette、動作確認を行う
- 提出前に subject の提出条件と差分を確認する
このテンプレートは、特定の課題構成を強制しません。
課題によっては、以下のような指定があり得ます。
- ルート直下に
.c/.h/Makefileを置く src/やincludes/などのディレクトリを使う- bonus 用ファイルを別名または別ディレクトリに分ける
- 提出してよいファイルが限定されている
ディレクトリ名やファイル配置は、必ず課題要件に合わせてください。
Makefile は雛形です。課題ごとに必ず見直してください。
確認する項目の例:
NAMEが課題で指定された成果物名になっているか- ライブラリ課題なら
.aを作る構成になっているか - 実行ファイル課題なら実行ファイルを作る構成になっているか
SRCSに必要なソースファイルがすべて含まれているかINCDIRがヘッダーファイルの配置と合っているかall,clean,fclean,reなど、課題で求められるターゲットがあるか- bonus が必要な場合、
bonusターゲットの要件を満たしているか
テンプレートの Makefile は、すべての課題にそのまま使えるものではありません。
このテンプレートには、簡単な GitHub Actions のフローが含まれています。
format-c.ymlc_formatter_42をインストールします- リポジトリ内の
.cと.hをフォーマットします - 差分があれば bot が commit / push します
norminette.ymlmainへの push と pull request で実行されます- 先にフォーマット用 workflow を呼び出します
- その後、
norminetteを実行します
notify-discord.ymlDISCORD_WEBHOOK_URLsecret が設定されている場合、結果を Discord に通知します
Actions は補助ツールです。ローカル環境、校舎環境、提出システムの結果と完全に一致する保証はありません。
提出前に少なくとも以下を確認してください。
- subject の提出ファイル一覧と一致している
- 不要なファイルやテストコードを提出対象に含めていない
make,make clean,make fclean,make reが期待通りに動く-Wall -Wextra -Werrorでコンパイルできる- Norminette に通る
- メモリリーク、未初期化値、未定義動作がない
- 許可されていない関数を使っていない
- bonus の扱いが課題要件と一致している
この README はテンプレートの説明用です。課題で README の内容が指定されている場合は、この内容を残すのではなく、課題要件に合わせて書き直してください。
This is a template repository for 42 C projects.
It is intended to provide a minimal starting point for C assignments. It includes a Makefile template and GitHub Actions workflows, but it does not automatically satisfy the requirements of every project.
If the assignment requires a README.md file or specifies what must be written in it, you must write README.md according to the assignment requirements.
The template author assumes no responsibility if using this template causes you to fail a review, automated grading, Norminette, submission check, or any other evaluation. You are responsible for verifying your own submission before turning it in.
In 42 projects, file names, directory structure, Makefile targets, submitted files, allowed functions, and forbidden items differ by assignment. Do not use this template as-is. Always read the subject and adjust the project accordingly.
- Create a repository from this template
- Read the assignment subject
- Place only the required files and directories
- Rewrite
Makefileto match the assignment requirements - Run compilation, Norminette, and behavior checks locally
- Before submission, verify the subject requirements and your final diff
This template does not enforce a specific project structure.
Depending on the assignment, you may be required to:
- Place
.c/.h/Makefiledirectly at the repository root - Use directories such as
src/orincludes/ - Separate bonus files by file name or directory
- Submit only a limited set of files
Always follow the assignment requirements for directory names and file placement.
Makefile is only a template. Review and update it for each assignment.
Examples of items to check:
- Whether
NAMEmatches the required output name - Whether library projects build a
.aarchive - Whether executable projects build the required executable
- Whether
SRCSincludes all required source files - Whether
INCDIRmatches the header file location - Whether required targets such as
all,clean,fclean, andreare present - Whether the
bonustarget satisfies the assignment requirements, if bonus is required
The template Makefile is not suitable for every assignment as-is.
This template includes simple GitHub Actions workflows.
format-c.yml- Installs
c_formatter_42 - Formats
.cand.hfiles in the repository - Commits and pushes changes as a bot if formatting creates a diff
- Installs
norminette.yml- Runs on push and pull request to
main - Calls the formatting workflow first
- Runs
norminetteafterward
- Runs on push and pull request to
notify-discord.yml- Sends the result to Discord if the
DISCORD_WEBHOOK_URLsecret is configured
- Sends the result to Discord if the
Actions are helper tools only. Their results are not guaranteed to match your local environment, campus environment, or the official submission system.
Before submitting, check at least the following:
- The submitted files match the subject
- Unnecessary files and test code are not included in the submission
make,make clean,make fclean, andmake rework as expected- The project compiles with
-Wall -Wextra -Werror - Norminette passes
- There are no memory leaks, uninitialized values, or undefined behavior
- No forbidden functions are used
- Bonus handling matches the assignment requirements
This README explains the template itself. If an assignment specifies README requirements, do not keep this content as-is. Rewrite it according to the assignment requirements.