in Programming & Dev9 months ago (edited)

My first exposure with the C programming language was yesterday, but JavaScript was the first computer language I ever learned. Although I haven't used JavaScript in approximately three months.


My current online school gave me assignments on the Preprocessor, Compiler, Assembly, and Linking phases of the C compilation process as my initial introduction to the language. These phases deal with converting code that is easy for humans to understand into machine code that the computer can quickly execute.

It is almost like using a translator when you want to communicate with someone who speaks a language other than your own. In order to the best of my ability and comprehension, I will describe these compilation phases in C.


This is the initial stage of compilation in C programming; it removes comments and expands macros after checking the libraries, which are indicated by the #include, in the code. The stdio.h and the unistd.h are two examples of C libraries. Every time one of these libraries is used, it must be declared because each one has its own functions. The "#include stdio.h>" library is necessary for the printf function to function.

To have access to the Processor file using gcc you only need to type this code:

gcc -E filename.c > filename

The preprocessor output of the file filename.c is saved in a new file filename as a result of this command.


The compiling stage follows, which simply transforms the code to assembly code. It serves as an intermediate between preprocessing and assembly. At this point, the code is still written in English.

To have a look at the code in the compiling stage, you use need to run this:

gcc -c filename.c

The output of running this command would give a file with a .o extension i.e. filename.o


The third stage of compilation is where the code is no longer in English or another human-readable language and has already been converted to binary or machine code, which a computer can readily understand.

To have a look at the assembly code, then you should run this command:

gcc -S filename.c

Following the execution of this command, a new file with the .s extension would be created, containing the assembly code.

Note: Every file used to program in C always have the file named with .c as the extension.\


Really, all I have to say about this procedure is that it is the final step in the compilation process and converts all the codes into executable files.


I would create a straightforward C program that outputs Hello World in this section of the article. additionally generates every piece of code that goes through the compilation process, i.e. I would execute only the preprocessing commands listed above.

I am using a Linux Ubuntu20.04 to run my commands and to create files, I am using the vi editor.

Hello World! C programming code

Hello World!.png

How to print "Hello World" is shown above. in C programming. As was previously mentioned, a library called "#includestdio.h>" must be used when using a function inside the library. My comment for the code, which is redundant and always removed during compilation, is found from my second to fifth lines. The code is formatted as follows:

 * main - Printing Hello world!
 * Return: Always 0 (Success)
int main(void)
    printf("Hello World!\n);

Printing Hello World! using Basic Compilation

Basic compilation.png

The gcc filename.c command is used to execute basic compilation. It is important to note that when I created my file, I used the.c extension, resulting in the filename: "hello.c."

When you run the basic compilation command, you will get a new file named a.out that contains the compiled output. To use it, simply type ./a.out, as shown in the screenshot below.


After running the command, you get your Hello World! output.

basic output.png

To Print the Preprocessing Output

To print the preprocessing output, simply execute gcc -E filename.c > filename. This command redirects the output to the new name "filename."

So, if I want to use this command on the hello.c file, it can be gcc -E hello.c > hello, or we can give it a another name entirely, gcc -E hello.c > testing. All provide the same output, but are saved under distinct file names.


vagrant@ubuntu-focal_ ~_C-programming 9_9_2022 5_26_41 PM.png

The image above shows that after running the program, a file named testing was saved, including the output after preprocessing. After running the code, the preprocessing code is shown below.

vagrant@ubuntu-focal_ ~_C-programming 9_9_2022 5_27_09 PM.png

This is what the code looks like after passing the preprocessor stage.

To print the compiling and assembly output, you only need to follow the gcc commands given above.

While attempting to study and share them in order to reinforce my learning, I will do my best to share my journey into the world of C Language. I'm hoping you will be with me on this adventure.


Designed by @ grisvisa

Starstrings01 AKA Giftedhands is a Hive lover, a Nigeria musician (Guitarist), and also a student who studies Mechatronics Engineering at the Federal University of Agriculture, Abeokuta.

His goal on Hive is to be more than a regular blogger but something more; someone with a purpose. That’s one of the reasons why he founded the newbies initiative @newbies-hive to help guide and support newbies. Kindly click here to follow the @newbies-hive curation trail.

He battles and struggles with balancing education and being active on the chain but yet his love and passion for Hive keep him on balance.

All images are mine except indicated otherwise






~~~ embed:1568624986134282244 twitter metadata:a3VzaHl6ZWVuYXx8aHR0cHM6Ly90d2l0dGVyLmNvbS9rdXNoeXplZW5hL3N0YXR1cy8xNTY4NjI0OTg2MTM0MjgyMjQ0fA== ~~~
The rewards earned on this comment will go directly to the people( @starstrings01, @kushyzee ) sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at https://hiveposh.com.

Very nice! I remember when I started to learn C two months ago, I got started with printing hello world but things got very complex later on but one thing I am grateful for is that I didn't give up.

Goodluck with your learning, it will tremendously supplement your knowledge of JavaScript and it will make you a better programmer when you eventually become a master at C

it will tremendously supplement your knowledge of JavaScript and it will make you a better programmer when you eventually become a master at C

This is the main reason why I am learning C. Felt it is important to learn it.

Like seriously, you make me feel like picking up from where I stopped. I learned javascrip last year but the last time. I did anything was December. I've almost forgot everything. Only Html and css still rings well in my head.

Pls, I would want you to do me a favour. Since you just start learning C programming, could you add a special tag to all your post on it heceforth so I could find them when I'm ready to move on with my coding training? I like the way you explained every step and I'm sure it would help alot. Thanks so much.

Sure, I would think of a tag then add to it. When I have, I would come back to this comment. Thanks for the comment...

Thank so much.

Hey brother! I have made a new tag called learn-cpl... I would be updating all my articles relating to C programming language on that tag!

That's fantastic bro. I will really keep in touch and let you know when I start. I appreciate you big time. One love bro.

Mehn, when I see things like this, I commend those involved for their perseverance. Even though I am not much into Python, it made me see the stress these C languages (C, C++ & C#) face to even print hello world🤣. I can relate a little since I once learned C++.

Very well, I see your learning has to deal with the core of computers. Keep up with the force, bro!

Thanks man. By the way it has been long we talked. Since you are at the backend track right?

Yes, I am.

Its been long really. I am also learning a skill alongside. And you know Nigerian boss, so my time is not really mine. You get?

I can relate to everything you said.. no worry, last last, hustle go pay.

All these C languages have never appeared friendly to me😂.
But I guess I've been able to pick up a few things from the little explanation you've provided. I'm just hoping that my very own journey into the C world won't be a complete disaster 😅.
Anyways, thanks for sharing!

Bro, learning C would make you a better JavaScript programmer and also, you can also come back to check my articles if you may need guidance on C programming

Sure...thanks a lot

An easier way to get assembly from C/C++ prototype code is with the Compiler Explorer, which provides a wide range of compilers and libraries to select from.

I am actually in the DevOps field so, I am trying to get myself better with Linux commands. Thanks for sharing the compiler, I would check it out.

All these programming terminologies 🤦🤦😂😂😂

All I can say is, more grace to you 🙏, more wisdom and knowledge in your learning process to reach the finish line successfully 👍

Lol.. it is not easy to understand ba? don't worry, anyone that wants to go into programming just needs to have a calm mind so he can process things easily!

Yes, it is not easy oo😂😂
Nearly bite my tongue trying to pronounce some wordings not to talk of taking it as a course 😂😂👍👏

This one is actually the very beginning of the course... so it is nothing compared to what's left.

My bro...I trying to do a little bit of programming...the only language I know is english sha. I sha read your post from start to finish...I understood 3% of it...I installed ubuntu for citizen project on @stemsocial

I am still more focused on animation but I'm struggling for time...

All the best...I know sey you go make us proud.

wait, you are running dualboot on your system... For me, I am only making use of the terminal.

😅 you don confuse me finish

What I meant is, are you running a Linux operating system alongside with Windows?

Lemouth said that the soft ware can help run their citizen project experiment. I'm yet to start sha

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support. 

Very interesting i hope you will share later more with us.

This language seems a bit difficult just by looking through the codes, I know C, C++ and JAVA have been on the programming trend for a long time and I commend guys that have been working with them, ordinary "hello world" is looking like a function
kudos to you sir. more grace and strength boss

Wow, when I first saw this post, I tried reading through but it was looking like Greek to me and I thought of trying it again but this time it is more like my native language 😢.

Well, I feel there is a really good knowledge here and those that are into the world of programming will understand it perfectly well.

I was just passing by sha 🚶‍♀️🚶‍♀️.