C Tutorial for Beginners
Kick-Start the C Learning
Before We Start:
Before going straightway to programming, it would be preferred to know some facts of interest about C programming:
C was designed by Dennis Ritchie at the AT & T’s Bell Laboratories of USA in 1972.
The first book for C came out in 1978 and it was titled The C Programming Language authored by Brian Kernighan and Dennis Ritchie.
The language was modified by the American National Standard Institute (ANSI) in 1988.
Are you bored? Ok. No more history. Happy? Good. Another thing you might be thinking is that, WHY C? Now-a-days, it is already superposed by modern languages like C++, C#, JAVA, PYTHON and many others. The answer is simple. These modern languages have directly or indirectly borrowed from C. For example, the control structures and other basic features of C++, JAVA and others are same as that of C. Although, PYTHON is an exception. So, if you learn C, you can also grab other languages very easily.
In today's world, C programming is used to develop:
Operating Systems
Compilers
Text Editors
Databases
Network Drivers and many others.
Enough of gyan! Now, lets make our hand dirty with some programming.
First C Program:
Prior going directly into the program, let me know which operating system are you using? Is it some kind if LINUX operating system like Ubuntu, Fedora, Red Hat Linux, Mint etc.? Then its absolutely fine. If it is WINDOWS, then it is recommended to have some LINUX OS installed in your laptop or computer. You may also have compilers like Borland C++, Dev C++, Turbo C++ etc. for your WINDOWS operating system, to run the C programs.
Step-wise explanation:
Step 1: Open a .c file in any text editor like vi, vim, gedit etc. from your LINUX terminal. For example, vi firstProgram.c
Step 2: Write the following code in the text editor:
/* First C Program*/
#include<stdio.h>
int main()
{
printf("C learning is a Fun.");
return 0;
}
Step 3: After you have written the code, press Esc key and type :wq and then hit Enter.
Step 4: Now, in terminal write gcc firstProgram.c and hit Enter.
Step 5: Next write ./a.out in the terminal and hit Enter.
Traaaallaaaa! Can you see the output? Nice. C learning is truly a real fun. Want to know how the output came? See my next blog post. I shall be covering all the basics of C programming language in my next blog posts.
Thank you for viewing this post. See you again.