31
loading...
This website collects cookies to deliver better user experience
Computer Systems: A Programmer's Perspective, by Randal E. Bryant and David R. O'Hallaron, Carnegie Mellon University
. This book is dedicated to understand how modern computers actually work. I should note that some of these topics are pretty hefty so don't worry if you find it confusing, so do I.hello.c
. If you want to set up your own project watch this YouTube Video HERE
#include <stdio.h>
void main() {
printf("Hello, World/n");
}
source code
and eventually through a series of steps it will get compiled down into instructions that our computer will be able to understand. But before we go any further lets have a little history lesson on the C programming language.#
character. For example we use #include <stdio.h>
which tells the preprocessor to read the contents of the standard header file and pastes the contents directly into our program file. The result is the creation of another C program typically with an .i
suffix. So in this phase our Hello.c
programs creates another file called Hello.i
.hello.i
into the text file hello.s
, which will contain assembly-language instructions. Assembly language is actually very useful because a lot of different compilers output the same assembly language.relocatable object program
and stores the results in a .o
file which contains encoded bytes that represent the machine language instructions instead of characters. If we opened this file it would look like gibberish to us.printf
which is part of the standard C library that is provided by every C compiler. However printf
is actually inside of a separate precompile object called printf.o
, for our code to work we need to merge it into our hello.o
program. This is what the linker does. It is a program that merges everything together into one file. The result is a executable object(executable) file. This file is now ready to be loaded into memory and executed by the system.Hello, World
printed to the console.