Introduction to Programming
Introduction to C
Programming means writing some piece of code, to solve a problem using the programming languages. The program will instruct the computer on what and how to do.
Programming Language
Programming languages are the aforementioned bridge-language which, we will use, as a medium to communicate with the computer.
Examples; the C programming language, C++, Python, Java, JavaScript, etc.
How to programme?
To programme, we use some piece of keywords, operators, logics, and more in some way. This is to instruct a computer to do our desired work.
We use some special languages that are close to our natural language to programme a computer.
We use the aforementioned languages, and write some specific code with the help of a text editor, like, notepad, sublime text, etc., save the code, and run some processes that include either interpretation or compilation or even conversion to an intermediate language.
What is a text-editor?
A text editor is a software to write and edit text. We use some popular text-editors like, notepad, sublime text, etc. to write and edit code.
The text editor with greater functionality to write code is generally called an IDE, or Integrated Development Environment. The IDE can also have some other features like, compiling, debugging, etc.
Interpreter and Compiler
We do not just write some code, but we need to either compile or interpret it and then run it. Compilation or interpretation is the process of converting the source code to a machine-level language(object code). It means, converting the code to a language that the computer can understand. The interpreter and compiler are the computer program that convert a code written generally in high level languages to a language that is understood by the computer, a machine code.
The difference between the two is that the interpreter converts each line of code to a machine code line by line, whereas the compiler converts the entire code to a machine code, at once or in parts, converting to some intermediate language.
Now, how to compile or interpret a code?
Generally, a compiler or an interpreter comes with the language itself. For example, C++ comes with a compiler, which is called g++, and an interpreter, which is called gdb. To compile or to interpret a code, we use some set of instructions to call the compiler or interpreter, asHey compiler/interpreter, compile/interpret file code.cpp For example, if we want to compile a C++ code, saved as code.cpp we use the commandg++ code.cppto compile the code. The result will be a file called a.exe, which is the output of the code. The output of the code is the result of the code. Then we use the command ./a.exe to run the code.
Introduction to C