Skip to content

Latest commit

 

History

History
105 lines (72 loc) · 4.97 KB

File metadata and controls

105 lines (72 loc) · 4.97 KB

0x00. C - Hello, World 🌍🚀

Hello World in C

Welcome to the 0x00. C - Hello, World directory! 🌟

This project marks the beginning of the ALX low-level programming curriculum and covers the fundamental concepts of compilation and C programming.

Project Overview 📚

This directory contains several files, each serving a unique purpose:

  1. 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:
      ./0-preprocessor <input_file> <output_file>
      
      Replace <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.
  2. 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:
      ./1-compiler <input_file> -o <output_file>
      
      Replace <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).
  3. 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:
      ./2-assembler <input_file> -o <output_file>
      
      Replace <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.
  4. 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:
      ./3-name <input_file> -o cisfun
      
      Replace <input_file> with the name of the C file you want to compile.
  5. 4-puts.c:

    • A C program that prints exactly "Programming is like building a multilingual puzzle," followed by a new line.
  6. 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.
  7. 6-size.c:

    • A C program that prints the size of various types on the computer it is compiled and run on.
  8. 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:
      ./100-intel <input_file> -o <output_file>
      
      Replace <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.
  9. 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.

Compilation Instructions 🛠️

To compile the C programs in this directory, follow these steps:

  1. Ensure you have a C compiler (such as gcc) installed on your computer.

  2. Open your terminal and navigate to the 0x00. C - Hello, World directory.

  3. 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).

  4. After successful compilation, you will find the output files or executables generated.

About the Author 👨‍💻

👤 Destiny Saturday (DestinedCodes)

📧 Email: [email protected]

Additional Resources 📖

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! 🚀*