24 Computer -- Programming Concepts and Logics

What are the advantages and disadvantages of C language?

What are the advantages and disadvantages of C language?

The advantages of C Programming Language are:


  1. C is general purpose programming language. You can generate different kind of software such as billing system, games, utilities, word processor, etc.
  2. C is the structured programming language. It uses structured statements such as while, for, etc.
  3. C is a standardized programming language. For example ANSI (American National Standards Institute) C is a standard programming language.
  4. The C language can run in any computer system. It is system independent.
  5. It has the small range of data types of detailed data manipulation statements with power data definition methods.
  6. It is a language of few words such that the programmer can remember them easily.
  7. It is a highly efficient programming language since C compilers are generally able to translate source code into efficient machine instructions.





The dis-advantages of C Programming Language are:


1. Lack of Object Orientation

C is a very vast and powerful language and simply follows the procedural programming approach. It doesn't extend its support to the concept of OOPs (Inheritance, Polymorphism, Encapsulation, Abstraction, Data Hiding). Here, you can't create a class with multiple inheritances like Java, Python, or C++. In OOP languages like Java, we can inherit methods from the parent class. But there is nothing similar in the C language. We cannot create subclasses for our classes. So it makes it difficult to reuse existing codes.

2. Inefficient Memory Management

In C Language you don't need any memory management techniques because it automatically manages all allocated resources for you. But if you want to use dynamic allocation then you should allocate dynamically by malloc function. If you do this manually then you will get a segmentation fault error. So we must always remember about Memory Management Techniques.

3. No Garbage Collection

Garbage collection is a feature that automatically reclaims memory from objects no longer needed by an application or library. It can be used for both automatic and manual garbage collection. Automatic garbage collection occurs when there is insufficient free space on the heap to allocate new objects; this may occur because all available physical RAM was allocated to other processes running on the computer system. Manual garbage collection involves explicitly freeing unused blocks of memory with calls to functions such as malloc.

But in C/C++ languages, there's no such feature of garbage collection as the culture of these languages is to leave storage management to the developer or programmer. Hence, it would be technically tedious and harsh on pockets to implement a precise garbage collector for C / C++.

4. Run-time checking

In the C programming language, the errors are not detected after each line of code. The compiler shows all the errors in the code only during the run-time of the whole which makes the checking of code (debugging) exceptionally complex in enormous projects. 

Also, the compiler doesn't check whether a variable was declared before its use. The programmer must remember this rule while writing programs. 

5. Concept of namespace is not present in C

C doesn't carry out the idea of namespaces. A namespace is organized as a chain of commands to permit the reuse of names in various settings. Without namespaces, we can't pronounce two factors of a similar name. 

However, C programming is devoid of this feature, and consequently, you can't characterize a variable with the same name in C. 

6. Absence of Exception Handling 

Special case Handling is perhaps the main element of programming dialects. While compiling the code, different errors and bugs can happen. Exception Handling permits you to identify the bugs and rectify them. Be that as it may, C doesn't show this significant feature.

7. Lacks Constructor and Destructor

C doesn't have any object-oriented functionalities, and hence, it doesn't have Constructor and Destructor features. So in C Language, you need to carry out the manual construction and/or destruction of the variable, either by utilizing a function or by different means.

More questions on Programming Concepts and Logics

Close Open App