Category Archives: C Language Overview

C Introduction

What is C? What is it for?

C is a general-purpose high-level (compiler language) computer programming language, developed by Dennis Ritchie at Bell Labs in late 1972 and was designed with the sole purpose to run on a PDP-11 with a UNIX operating system. Let’s know more about c introduction.

C is known as programmer’s language, every program we write is limited by the language which is used to write it but in the case of C, we can program anything from small programs for personal amusement to the new operating system. C is one of a large number of high-level languages which can be used for general-purpose programming. C is best suited for modern computers and modern programming.

High Levels and Low Levels

Computer programming languages majorly are of two types, that is Low-Level Languages and High-Level Languages. Low-Level languages are further categorized into Machine language and Assembly language. This level depends upon the condition that how closely they interact with the computer. Low level is perhaps the easiest to understand, Low level languages are machine-oriented and work most closely to the hardware, and require extensive knowledge of computer hardware, its configuration, and organization.

Machine Language

Machine Language is the language which directly understood by the computer and does not need any further translation before execution. In Machine Language instruction is given in form of machine code and which is a string of 1′s (one) and 0’s (zero). When this sequence of codes is sent as input to the computer, it understands the codes and converts them into electrical signals to perform a specific operation.
Machine Language is not easy to learn. The only advantage is that program run very fast because no further translation is required for the CPU to execute it.

Assembly Language

It is the first level of improvement in the programming language. An assembly language program is a set of human-readable shortcodes that substitute opcodes (Operation Codes). A translator program is required to translate or map the Assembly Language to machine language. This translator program is known as ‘Assembler’. Assembly language is much easier to write learn and debug than machine language.

Let’s take look at the below example code where the same instruction is coded in machine and assembly language: The instruction means:

add the integers in registers $t1 and $t2 and put the result in the register $t0.

Assembly language is machine-dependent means programs written for one computer might not run in other computers with different hardware configurations.

HIGH-LEVEL LANGUAGES

High-Level Languages instructions are given in natural English-like words, it is many problems oriented irrespective of the type of computer you are using. High-level languages not only give as a way to express instructions to computers, but they also give a channel of communication among human beings. They are not machine biased instead they give away to express ideas and a way to solve logical problems.

In High-Level Languages, you must be well versed with tokens, keywords, programming syntax, and the logic of the problem to solve a specific problem.

To execute a set of instructions on a specific machine that is programmed in High-Level Language, it must be translated first to its machine language. This is done by a computer program that is known as a compiler. A Compiler is a program that translates a High-level language program to a machine language code which is executable code. By using the appropriate compiler we can execute our High-level language programs on any platform.

HLLs Advantages:

  • High-level language programs are machine-independent.
  • High-level languages are more abstract and easy to learn and do not require deep knowledge of computer hardware.

C is known as a high-level, compiler language. C language is equipped with a full-fledged set of features that allow programs to write a program in an organized, easy, and logical way. This is very important when we are writing lengthy programs because complex problems are only manageable with a clear organization and program structure. C gives a way for creating meaningful variable names and meaningful function names to be used in programs without having loss of efficiency and effectiveness of the program, it gives complete freedom of coding style. It has a set of very flexible control structures for decision-making and looping that is excellent for controlling the flow of programs.

C Programming Language characteristics

  • Function or procedure-oriented
  • C is much more flexible and free-wheeling.
  • Small Size
  • Loose typing
  • Structured Language
  • Low level or BitWise operation readily available
  • Pointer implementation – extensive use of pointers for memory, array, structures, and functions.

C Programming Language Advantages

  • Easy to learn and use
  • It has high-level constructs that allow the programmer to organize programs in a clear, easy, and logical way.
  • Full-fledged set of features we can program anything from a small program for personal amusement to a new operating system.
  • Platform Independent and portable
  • Higher the speed of program execution
  • A lot of libraries are already written in C.

C Programming Language Disadvantages

  • C does not have an OOPS feature
  • There is no strict type checking (for example we can pass an integer value for the floating data type).
  • Poor error detection at runtime
  • C doesn’t have the concept of the namespace.
  • C doesn’t have the concept of constructors and destructors.