What is Compiler
see the following images:
conversation by an interpreter
There are three persons. First one knows only English and third person knows only chines. The second person knows both (English and chines). To continue the conversation middle person act as an interpreter. For example, when first person speak interpreter translates the English into chines and then convey to the third person.
A compiler does the same as the interpreter did. C programming is readable for human. It is English like language but Computer does not understand the C programming. Compiler convert the C programming into machine code and command the computer to do what programmer wants. Thus compiler is as like as an interpreter between programmer and computer.
Prerequisite software (code block compiler):
You have to install a compiler to write C programming code. There are a lot of compiler to write C programming code. I would like to suggest you to install code block compiler. It is a nice compiler. You can download it from the following link
Now install it as other software. If you are facing any problem to install just click the following link and see the video
Your First C Program
Now you know how to write code in code block compiler. Well, let me explain a simple C programing code line by line.
#include<stdio.h> int main() { printf("Hello world"); return 0; }
line 1: we typed #include. By this line we include stdio.h file to our program. This file has been created while you installed code block. You should not worry about the commands written in stdio.h file.
line2: Here is int main(). this is called main() function. Every C program has this function. Execution will start from the opening brace ‘{‘ followed by int main()
Line3: ‘{‘ it represents the starting point of main() function.
Line4: We typed here printf(“Hello world”); . printf(); is a library function of C programming. inside the ‘()’ we provide our string to be printed. Here our string is Hello world. All commands to print a message by printf() function have been written inside stdio.h file.
line5: return 0; line tells the compiler to return ZERO where this main() function is called. Are you still confused about this explanation? don’t worry just skip and continue. We will discuss it broadly in FUNCTION topic.
Line6: ‘}’ is called closing brace which represents the end of opening brace, ‘{‘.
Now, you know how this 6 lines code works.
Next