Paradigm can also be termed as method to solve some problem or do some task. Programming paradigm is an approach to solve problem using some programming language or also we can say it is a method to solve a problem using tools and techniques that are available to us following some approach.
Imperative or Procedural Programming as the name suggests is a type of programming paradigm that describes how the program executes. Developers are more concerned with how to get an answer step by step. It comprises the sequence of command imperatives. In this, the order of execution is very important and uses both mutable and immutable data. Fortran, Java, C, C++ programming languages are examples of imperative programming.
Further reading https://softwareengineering.stackexchange.com/questions/117092/whats-the-difference-between-imperative-procedural-and-structured-programming
Object oriented programming – The program is written as a collection of classes and object which are meant for communication. The smallest and basic entity is object and all kind of computation is performed on the objects only. More emphasis is on data rather procedure. It can handle almost all kind of real life problems which are today in scenario.
Advantages:
Data security
Inheritance
Code reusability
Flexible and abstraction is also present
Examples of Object Oriented programming paradigm: Simula, Java, C++, Objective-C, Visual Basic .NET, Python, Ruby and Smalltalk.
Functional programming paradigms – The functional programming paradigms has its roots in mathematics and it is language independent. The key principal of this paradigms is the execution of series of mathematical functions. The central model for the abstraction is the function which are meant for some specific computation and not the data structure. Data are loosely coupled to functions. The function hide their implementation. Function can be replaced with their values without changing the meaning of the program. Some of the languages like perl, javascript mostly uses this paradigm.
Declarative programming paradigm: It is divided as Logic, Functional, Database. In computer science the declarative programming is a style of building programs that expresses logic of computation without talking about its control flow. It often considers programs as theories of some logic. It may simplify writing parallel programs. The focus is on what needs to be done rather how it should be done basically emphasize on what code code is actually doing. It just declares the result we want rather how it has be produced. This is the only difference between imperative (how to do) and declarative (what to do) programming paradigms.
https://www.geeksforgeeks.org/introduction-of-programming-paradigms/
Any program written in a high-level language is known as source code. However, computers cannot understand source code. Before it can be run, source code must first be translated into a form which a computer understands - this form is called object code. A translator is a program that converts source code into object code. Generally, there are three types of translator:
A compiler takes the source code as a whole and translates it into object code all in one go. Once converted, the object code can be run at any time. This process is called compilation. All of the object files used in a program must be combined before the program can be run. This is done using a linker tool, which takes one or more objects and groups them into a single executable or a library.
An interpreter translates source code into object code one instruction at a time. It is similar to a human translator translating what a person says into another language, sentence by sentence. The resulting object code is then executed immediately. The process is called interpretation.
Assemblers are a third type of translator. The purpose of an assembler is to translate assembly language into object code. Whereas compilers and interpreters generate many machine code instructions for each high-level instruction, assemblers create one machine code instruction for each assembly instruction.
https://www.bbc.co.uk/bitesize/guides/zmthsrd/revision/1
This is an intermediate concept, between the compiler and the interpreter, popularized by the Java programming language. The idea is to write programs in high-level language, but instead of compiling it (translating) into machine language, it translates it into an intermediate code. This intermediate code is executed by an interpreter known as Virtual Machine.
Java and C # are the best examples of this type of languages.
http://www.edu4java.com/en/concepts/compiler-interpreter-virtual-machine.html
further reading https://www.geeksforgeeks.org/language-processors-assembler-compiler-and-interpreter/
The compilation process contains the sequence of various phases. Each phase takes source program in one representation and produces output in another representation. Each phase takes input from its previous stage. There are the various phases of compiler:
Lexical analyzer phase is the first phase of compilation process. It takes source code as input. It reads the source program one character at a time and converts it into meaningful lexemes. Lexical analyzer represents these lexemes in the form of tokens.
Syntax analysis is the second phase of compilation process. It takes tokens as input and generates a parse tree as output. In syntax analysis phase, the parser checks that the expression made by the tokens is syntactically correct or not.
Semantic analysis is the third phase of compilation process. It checks whether the parse tree follows the rules of language. Semantic analyzer keeps track of identifiers, their types and expressions. The output of semantic analysis phase is the annotated tree syntax.
In the intermediate code generation, compiler generates the source code into the intermediate code. Intermediate code is generated between the high-level language and the machine language. The intermediate code should be generated in such a way that you can easily translate it into the target machine code.
Code optimization is an optional phase. It is used to improve the intermediate code so that the output of the program could run faster and take less space. It removes the unnecessary lines of the code and arranges the sequence of statements in order to speed up the program execution.
Code generation is the final stage of the compilation process. It takes the optimized intermediate code as input and maps it to the target machine language. Code generator translates the intermediate code into the machine code of the specified computer
https://www.javatpoint.com/compiler-phases
further reading https://www.guru99.com/compiler-design-phases-of-compiler.html
https://www.geeksforgeeks.org/phases-of-a-compiler/
https://www.tutorialspoint.com/compiler_design/compiler_design_phases_of_compiler.htm
int - whole numbers positive or negative
float or double - numbers with a decimal point positive or negative
char - one single character or digit or symbol or space
There is no string data types in C so an array of characters is used to hold a word or phrase or sentence
e.g. char name[20]
This will hold twenty characters in an array of datatype char with a variable called name