Git Product home page Git Product logo

alx-low_level_programming's Introduction

Don't hate the hacker, hate the code

coding

C is FUN

Learning C right now, been wanting to get on this. It's going to be FUN !!.


About

  • This repository consists of all the C programming projects done with ALX Africa Full stack Software Engineering course in partnership with Holberton School.
  • All main.c files are prewritten by the school. We build functions that produce a specific output while also taking into consideration edge cases.

Content table

  • 0x00 : Hello, World.
  • 0x01 : Variables,if,else,while.
  • 0x02 : Functions, nested loops.
  • 0x03 : Debugging.
  • 0x04 : More Functions and nested loops.
  • 0x05 : Pointers, arrays and strings.
  • 0x06 : More pointers, arrays and strings.
  • 0x07 : Even more pointers, arrays and strings.
  • 0x08 : Recursion.
  • 0x09 : Static libraries.
  • 0x0A : argc, argv[].
  • 0x0B : Malloc, free.
  • 0x0C : More malloc, free.
  • 0x0D : Preprocessor.
  • 0x0E : Structures, typedef.
  • 0x0F : Function pointers.
  • 0x10 : Variadic functions.
  • 0x11 : Write our own printf project.
  • 0x12 : Singly linked lists.
  • 0x13 : More singly linked lists.
  • 0x14 : Bit manipulation.
  • 0x15 : File I/O.
  • 0x1C : Makefiles.
  • 0x1D : Binary trees.
  • 0x1E : Search Algorithms.

C Program Compilation

The compilation process has four different steps:

  1. The preprocessing stage
  2. The compiling stage
  3. The assembling stage
  4. The linking stage

Step 1: Preprocessing -E

The preprocessor reads the source code and performs various transformations to it:

  • Expanding macros (replacing all of the macros with their values)
  • Handling include files (replaces the #include macro with the content of the header file specified in <>)
  • Removing comments
  • The results in a new file called a translation unit stored in a file with .i extension (intermediate)

Step 2: Compiling -S

The build phase provides us with assembly code that is unique to the target architecture.

In this step the compiler takes action by taking a preprocessed file which checks for syntax or structure errors (in case of errors the compilation process stops and displays the corresponding errors). After compiling it, it generates an intermediate code in assembly language file.s.

Step 3: Assembing -c

In the third stage of compilation, an assembler is used to convert assembly language into machine code. The assembler takes the code and generates an object file file.o, which contains machine code that is not yet executable because it needs to be mapped to a specific memory address. The linker combines all the object files, resolves references between modules, and corrects the addresses, creating an executable file.

Step 4: Linking

The linker is an important tool in compilation that performs two tasks: resolution and relocation of symbols. It arranges the pieces of object code so that functions in one piece can successfully call functions in others. The linker also adds parts that contain the instructions for the library functions used by the program. The result of this stage is the executable file. usually a.out if -o is not specified.


Resource


alx-low_level_programming

Low-level programming & Algorithm

Module of Low-level programming and algorithm, carried out during Full Stack Software Engineering studies at ALX Software Engineering School**.

Technologies

  • Scripts written in Bash 4.3.11(1)
  • C files are compiled using gcc 4.8.4
  • C files are written according to the C90 standard
  • Tested on Ubuntu 20.04 LTS

Projects

All of the following folders are projects done during the studies:

Project name Description
0x00-hello_world It aims to learn about what is entry point, basics commands (puts, printf, putchar), compilation process with gcc in C language
0x01-variables_if_else_while It aims to learn about arithmetic operators, relational operators, boolean operators, comments, declaring variables and loops in C language
0x02-functions_nested_loops It aims to learn about header files, functions, loops and nested loops in C language
0x03-debugging It aims to learn how to debug in C language
0x04-more_functions_nested_loop It aims to learn about nested loops in C language
0x05-pointers_arrays_strings It aims to learn about pointers and arrays in C language
0x06-pointers_arrays_strings It aims to learn about pointers and arrays in C language
0x07-pointers_arrays_strings It aims to learn about pointers and arrays in C language
0x08-recursion It aims to learn about recursion and how to implement it in C language
0x09-static_libraries It aims to learn about static libraries in C language
0x0A-argc_argv It aims to learn about how to use arguments passed to a program in C language
0x0B-malloc_free It aims to learn about automatic and dynamic allocation in C language
0x0C-more_malloc_free It aims to learn about how to use malloc, calloc, realloc and exit functions in C language
0x0D-preprocessor It aims to learn about how to include guard in the header files and macros in C language
0x0E-structures_typedef It aims to learn about structures and typedef in C language
0x0F-function_pointers It aims to learn about function pointers in C language
0x10-variadic_functions It aims to learn about variadic functions in C language
0x12-singly_linked_lists It aims to learn about linked lists in C language
0x13-more_singly_linked_lists It aims to learn about singly linked lists in C language
0x14-bit_manipulation It aims to learn about how to manipulate bits and use bitwise operators in C language
0x15-file_io It aims to learn about how to handle files (open, close, read and write), file descriptors, system calls and file permissions in C language
0x17-doubly_linked_lists It aims to learn about doubly linked list in C language
0x18-dynamic_libraries It aims to learn about dynamic and shared libraries in C language
0x19-stacks_queues_lifo_fifo Submodule of monty, an interpreter of Monty ByteCode files written with C language
0x1A-hash_tables It aims to learn how to implement Hash Tables with C language

Author

alx-low_level_programming's People

Contributors

salihabrik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.