Translate

important

What is C programming language? Features and Advantage of C language

Ken Thompson developed a new language called "B". B language was interpreter based, hence it was slow after that Dennis Richie modified "B" language and made it compile based language, the modified compiled based "B" language is named as "C".

C is a general purpose high level programming language that was originally developed by Dennis Ritchie for the UNIX operating system; it was first implemented on the digital equipment corporation PDP 11 in 1972.


The UNIX operating system and all UNIX applications are written in C language. Now on that time 'C' has become widely used professional language for the various reason:-

  1. Easy to learn
  2. It is a structured programming 
  3. It produced efficient programmers
  4. It can handle low level activities
  5. It can be compiled on a variety of computers.

What is C programming language


Facts about C programming

i) It was invented to write Operating System called UNIX.

ii) The language was finalized in 1988 by the American National Standard Institute (ANSI).

iii) Today C is the most widely used system programming language.

iv) Most of the state of the art software has been implemented using 'C'.


Why do we use C?/Application of C.

C was initially used for system development work in particular the program makeup of the operating system.


C was adopted as a system development language because it produced code that run nearly as fast as coffee written in assembly language.


Some examples of use of 'C' are operating system, language compiler, text editor, print, network device, modem, programs, databases, utilities.


Features of C programming

There are various features of C programming that make it popular in technical as well as industrial management.


Some out of them are written below:-

i) Simple and efficient:- C language is a simple and efficient language. We can learn it easily.


ii) Easy syntax style:- The syntax style of C language is easy. We can use C to design applications that were previously designed by assembly language.


iii) Memory management:- It allows you to allocate memory at run time, that it supports the concept of dynamic memory allocation.


iv) Pointer:- C language provides a pointer that stores the memory address as it's value. Pointers are useful in storing and accessing the data from memory.


v) Compiler based:- C is a computer compiler based language that compiles (checks) the complete line of code at same time, which help to save execution time.


vi) Case sensitive:- C is case sensitive programming language, because in C uppercase and lowercase characters are treated differently. If you write "program" and "Program" in C then both are separate.


vii) Structured oriented:- C is a strictures oriented programming language this means you can divide your code or task within a function to make it interactive.

The functions also help in code reusability.




Advantage of C programming Language 

i). C language is simple and efficient.


ii). It is easy to learn because it's statement is similar to a human statement.


iii). C language can be compiled on a variety of computers.


iv). C language provides pointers by which we can access the data from memory for multiple functions in a program.


v). It supports dynamic memory allocation by which we can specify memory at run time.


vi). C is a structured oriented programming language so we can reuse the code in another program for the same function instead of wiring again.


vii). C is a compiler based language and the compiler checks the whole code at one time and runs or shows all errors at once so that we can fix all the errors at once and save our time.


viii). C is a procedure programming language so we can write C programs by following a particular procedure and hence it reduces the chance of error occurring in a program.


ix). Although C language is a high -level language, it runs nearly as fast as code written in assembly language.


x). In C language we can divide our code within a function to make it interactive.


Disadvantage of C programming language

i). Run time checking: In C language the compiler checks the whole code at one time and not line by line. That's why errors or bugs are not detected after each line of code, the compiler shows all the errors after writing the program which makes the checking of code very complex in large programs.


ii). Lack of concept of OPPs: C is considered to be a very vast language but it does not support the concept of OPPs(Inheritance, Polymorphism, Encapsulation, Abstraction, Data hiding etc). It simply follows the procedural programming approach.


iii). Concept of namespace: You can not define a variable with the same name in C because it does not implement the concept of NAMESPACE, a structured chain of commands which allow the reuses of names in different contexts.


iv). Constructor or Destructor: Constructor and destructor both are the member functions which support the basic functionality of object oriented programming but C does not have any constructor or destructor.


v) Lack of Exception handling: At the time of compiling the code various anomalies and bugs can occur and exception handling allows us to catch the error and take appropriate responses. But C does not have this feature.


vi) Low level of abstraction: C is a small and core machine language that has minimum data hiding and exclusive visibility that affects the security of this language.


How to write and compile a C program in Computer?


In your computer you can write a C program in Notepad/Notepad++ application or VS(visual studio) code. But to compile/run it you will need to install a C compiler in your computer, you can install GCC compiler which compiles C program into executable file and run.


After installing GCC compiler in your computer you will have to copy the path of GCC compiler bin folder and will have to paste it to Path place in System variable. 


After all setting up now you can write your C program in notepad/notepad++ and you will have to save the document file with the extension of ".c" for example if your file name is hello than you will have to write it "hello.c" and have to save it.


And You can compile your code with the help of CMD(command prompt).


C language Syntax:

When you start writing your C program than you have to follow some rules which are given below.

Syntax with comments,comments are ignored by the compiler.


#include<stdio.h>

//This is a header file(preprocessor).

int main()

/*This is main function the program start to run from main function*/

{

//your statement_ _ _ _ ;

}.


The statement written between "//" and "/*_ _ _*/ are called comments which are ignored by the compiler.


Programmers write this to make code readable and understandable.


Below the C language example is given without comment:


#include<stdio.h>

int main()

{

Printf("hello world");

return 0;

}


Out of the above code is: hello world

After writing above program of C I will have to save the file with "anyname.c"

And to compile it I will have to open CMD in my computer and have to find the address of the file where that is saved.


And then have to give instructions to compile the file to the GCC compiler and finally the program will compile.


I will discuss more about the C language in my next post.

Till then bye!

.






 











Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Top Post Ad

Below Post Ad