An awesome C TUTORIAL with quality contents. Read this C TUTORIAL in free. This tutorial is divided into several sections to avoid your confusion. To read every page of this C TUTORIAL, go down of every page and click on next or prev option in order to navigate to the next page or previous page.
A SHORT INTRODUCTION ON C TUTORIAL
C is a general-purpose, procedure-oriented computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories. It was developed to develop the UNIX operating system.C is the most widely used computer language.
It continues fluctuating at number one scale of popularity along with Java programming language, which is also equally popular and most widely used programming language among modern software programmers.
WHO IS AUDIENCE?
This C TUTORIAL is designed for software programmers with a need to understand the C programming language starting from scratch. It will give you enough understanding of the C programming language from where you can take yourself to a higher level of expertise.
Before starting with this c language tutorial, you should have a basic understanding of Computer Programming terminologies. Because a basic understanding of any of the programming languages will help you in understanding the C programming concepts. In addition, it will boost your learning speed.
UNDERSTAND BASICS OF COMPUTER FIRST
What is a Computer?
A computer is an electronic device that takes input from the user, process that input and gives output. Laptops, Desktop computers, mobile phone, Digital watch, Digital camera, etc are also computers as they work on given input however their capabilities differ. You might be asking this is too basic however there is connectivity read below.
Does zero or one exist inside a computer?
Well, there is no physical significance of 0 and 1 inside the computer. These are just representation of two states of voltage in digital circuits, the high voltage is represented with 1 and low voltage with 0.
Why to understand 0 and 1 fundamentals?
Computers understand only binary language which is represented in the form of 0 and 1. In other words, you can say Computers are just a machine that can work on our instruction. But, we can’t say “Computer! Please print my name on screen”. Yeah, if we can!
A computer can’t work in the above situation as it doesn’t understand our language. Just assume computers as aliens which understand only the language of 0 and 1.
What is Hardware?
Hardware is a physical device consisting of a machine, wires, and circuits. Hardware is a comprehensive term for all of the physical parts of the computer.
Below are a few common physical parts in a computer:
- Mother Board
- Central Processing Unit (CPU)
- Random Access Memory (RAM)
- Hard Drive
Let’s Understand File System
A file is a collection of data or information that has a name to identify. The computer file is a bundle, created by a program used to refer back to saved work or support operations of the program.
There are different types of file
- Text File
- Audio File
- Video file
- Program file
File name and extension is separated by a dot operator. The file extension tells about the type of file. For example, rock.mp3 is a file with filename rock and file type is audio. This means that rock is a music file.
Similarly, in c programming language your final software will have a .exe extension. Dot exe (.exe) stands for executable.
Have You enjoyed article C TUTORIAL!
How a C Program executes?
It is important to discuss how a C Program executes. As a result, it will help you to understand memory allocation, the working process of different hardware. In addition, all these things will help you in cracking interview easily or to become a pro developer.
- C Program file is stored somewhere in the hard disk of your system.
- Whenever we click on it to run this program. The click event is listened by the operating system and loads this file from hard disk to RAM (Random Access Memory) using loader (a dedicated program to load content to RAM).
- RAM is a type of primary memory which is volatile in nature, this means that nothing can reside permanently in RAM.
- In addition, RAM contains only those programs which are active at a particular instant.
- The operating system allocates memory for the program in RAM.
- First instruction goes to the processor and resides in the instruction register.
- This instruction is decoded by the control unit.
- Control unit sends appropriate signals to ALU (Arithmetic Logic Unit) and ALU performs a specific task.
- By the way registers, control unit and arithmetic logic unit are part of the processor. ALU is responsible for all kind of arithmetic, logical and shift instructions.
- Similarly, next instruction moves to the processor and stored at the instruction register, control unit decode it and sends a signal to ALU.
- Every instruction of the program executes same in a sequence. As soon as the last instruction is executed, the memory of the program will be released from RAM.
Why Learn C Language?
Instead of being one of the oldest programming languages, C is not dead yet. In these days also C language is very popular because of its reliability, simplicity, easy to use features.
There are many opinions that are often heard today is – “C has been superseded by other programming languages like C++, C#, and Java”. However, in my opinion, there are many reasons for learning the C language.
Let us see few reasons one by one.
- Major parts of famous working frameworks and operating systems like Windows, UNIX, Linux, and Android are written in C. Even today when performance (speed of execution) is considered, C becomes primary choice of programmers.
- Mobile devices like smartphones and tablets have become very popular today. Also common devices like the washing machine, microwaves are getting smarter by the day. This smartness comes from a microprocessor. And these programmes need to run fast as well as they need to work in a constrained measure of memory. For your kind information, these programs are written in C.
- Let us take the example of a video game. Just assume if you are firing a bullet and bullet hits the target after a delay of 10 sec. Will you play that game? Never! Because of speed, as speed matters for you.
- To match the expectation of the player the game has to respond fast to the user inputs. This is the condition where C language scores over other languages. In addition, many popular gaming frameworks, for instance, DirectX and gaming engine like Allegro have been built in C language.
- In addition, if it comes to interaction with hardware devices, C is the best choice of programmers. Because c provides several elements that make this interaction feasible without compromising performance.