what does \n and %d mean?
Here, in C programming \n is an escape character that helps to create a new line whereas %d is a format specifier that allows to specify only Integer values.
What are the advantages and disadvantages of C language?
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.
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.
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++.
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.
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.
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.
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.