This project marks the beginning of the ALX low-level programming curriculum and covers the fundamental concepts of compilation and C programming.
This directory contains several files, each serving a unique purpose:
-
0-preprocessor:
- This script runs a C file through the preprocessor and saves the result into another file.
- Instructions for use: To preprocess a C file, open your terminal and navigate to the 0x00. C - Hello, World directory. Then, execute the following command:
Replace
./0-preprocessor <input_file> <output_file>
<input_file>
with the name of the C file you want to preprocess and<output_file>
with the name of the file where you want to save the preprocessed output.
-
1-compiler:
- This script compiles a C file but does not link it.
- Instructions for use: To compile a C file without linking, open your terminal and navigate to the 0x00. C - Hello, World directory. Then, execute the following command:
Replace
./1-compiler <input_file> -o <output_file>
<input_file>
with the name of the C file you want to compile and<output_file>
with the desired name of the output file (executable).
-
2-assembler:
- This script generates the assembly code of a C file and saves it in an output file.
- Instructions for use: To generate the assembly code from a C file, open your terminal and navigate to the 0x00. C - Hello, World directory. Then, execute the following command:
Replace
./2-assembler <input_file> -o <output_file>
<input_file>
with the name of the C file you want to convert to assembly and<output_file>
with the name of the file where you want to save the generated assembly code.
-
3-name:
- This script compiles a C file and creates an executable named "cisfun".
- Instructions for use: To compile a C file and create an executable named "cisfun", open your terminal and navigate to the 0x00. C - Hello, World directory. Then, execute the following command:
Replace
./3-name <input_file> -o cisfun
<input_file>
with the name of the C file you want to compile.
-
4-puts.c:
- A C program that prints exactly "Programming is like building a multilingual puzzle," followed by a new line.
-
5-printf.c:
- A C program that prints exactly "with proper grammar, but the outcome is a piece of art," followed by a new line.
-
6-size.c:
- A C program that prints the size of various types on the computer it is compiled and run on.
-
100-intel:
- This script generates the assembly code (Intel syntax) of a C file and saves it in an output file.
- Instructions for use: To generate the assembly code (Intel syntax) from a C file, open your terminal and navigate to the 0x00. C - Hello, World directory. Then, execute the following command:
Replace
./100-intel <input_file> -o <output_file>
<input_file>
with the name of the C file you want to convert to assembly and<output_file>
with the name of the file where you want to save the generated assembly code.
-
101-quote.c:
- A C program that prints exactly "and that piece of art is useful" - Dora Korpar, 2015-10-19" to the standard error.
To compile the C programs in this directory, follow these steps:
-
Ensure you have a C compiler (such as gcc) installed on your computer.
-
Open your terminal and navigate to the 0x00. C - Hello, World directory.
-
Choose the file you want to compile:
-
If it is a script (e.g., 0-preprocessor, 1-compiler, etc.), follow the corresponding instruction provided above for each script.
-
If it is a C source code file (e.g., 4-puts.c, 5-printf.c, etc.), use the following commands to compile and run:
gcc <filename.c> -o <output_file>
./<output_file>
Replace
<filename.c>
with the name of the C file you want to compile, and<output_file>
with the desired name of the output file (executable). -
-
After successful compilation, you will find the output files or executables generated.
👤 Destiny Saturday (DestinedCodes)
📧 Email: [email protected]
For more insights and details about this project, I've written a blog post that provides a comprehensive guide to C Programming 101. Feel free to check it out here.
Note: *This project serves as an introduction to C programming and lays the foundation for your journey into
low-level programming. Enjoy the learning process, and remember, practice is key to becoming a proficient C programmer! 🚀*