DEV Community

Cover image for Beginner to Pro in C programming!
Muzammil Bilal Tanwar
Muzammil Bilal Tanwar

Posted on

Beginner to Pro in C programming!

Why C?

If you are a student or a professional developer, or even someone who codes for a hobby, everything starts with a hello, world.

As you know C language is the foundation of all programming languages, therefore it is timeless and is widely respected in the industry for its hassle free operations in developing Operating systems, IOT and embedded systems.

Let's say hello to C language!

Benefits of learning C
I personally believe that C is one of the best starting languages if you need to understand how programming works close to the metal, without touching assembly or lower level languages.

C has an easy syntax and uses libraries for vast operational access so therefore it is easy to write logic in C.

Logic is one of the most important part in any programming language, as you may be able to learn the syntax but unless you add logic to it, the code is basically useless.

Where to start?
My personal favorite C language book would be C by Brian Kernighan and Dennis Ritchie. Popularly known as "K&R C language". It was written by the makers of C themselves.

You can also continue with a lot of tutorials on YouTube and online, but it is crucial to spend 1 hour on concepts and 1 hour on programming daily apart from the sessions or any resource materials you may have.

The Technical Part
Here we come to the technicalities of C, I will cover some basic topics required to give you a head start!

Compiler
Compiler is basically a translator that converts C language into Machine language for the computer to understand (0's and 1's).

Compiler compiles the whole program once, and only points out any errors if present after going through the whole program.

Common compiler examples are GCC, GNU.

Now you may come across another term "Interpreter" however it is not used in standard practice while coding in C.

Interpreter processes the programs line by line and would stop executing if it finds an error before the end of program.

IDE: Integrated Development Environment
An IDE contains everything from compiler, code editor to debugger.
Recommended IDE's for C are Code blocks, Vs Code.

There are online plug and play IDE's available like Programmiz.
These do not require any installation on the system, but they need a stable internet connection.

Basic C program

#include <stdio.h>
int main () {
printf("hello world);
return 0;
}

The above has a basic C program to display hello world as an output.
Main components of C program include:

  1. Preprocessor Directive: #include<stdio.h> contains the input output operations and is known as standard input output library, without it, we cannot print or take input/outputs.

  2. Main function: main function serves as the entry point of your C code, this is where the compiler starts executing the code. int main ()

  3. Program Body: The content inside {...} curly braces are called as the program body, here you will use any variables, functions and statements.

  4. Statements: The individual line of code or instructions of code you provide to the computer for it to display the desired output, like we did for hello world.

  5. Return statement: Signifies that the program has ended successfully also acts as an exit point of the program.

Conclusion Thoughts
Notice how I did not elaborate on terms like variables, data types, and more?

That is because the more you research on your own, the better you understand the language in detail, that is one of the best ways to learn anything not just programming.

Hope you are one step closer to being a C programmer.

Thanks a ton for reading, make sure to follow for more, if this was useful!

Top comments (0)