Best Blog site in India – Write Your Story on Yoursnews

Yours News
CareerEducation

Diving Into The World Of C: The Language Tops Programmer’s Choice Again!

C is a widely celebrated programming language that was originally developed at Bell Labs by Dennis Ritchie between 1972 and 1973. While most of the languages tend to enforce a programming paradigm, i.e., a particular style and design method upon their users, either for commercial purposes or market demands, constricting the ability of the programmers to solve a single problem with different approaches, C was developed with a completely different goal in mind.

Ritchie’s vision was to code a programming language that could boost the intellectual caliber of a programmer as well as create a free environment for him to independently venture into his creativity. It is due to this reason that C has very few restrictions and is so flexible. The language is the very definition of speed, stability, and near-universal availability. C’s layer of abstraction is extremely thin and so the overhead is low, enabling programmers to create efficient implementations useful for computationally intense programs.

A common notion is that C is merely procedural-oriented. No! To your surprise, this beauty of a language is both procedure-oriented as well as object-oriented. Let me clarify a bit. Cardelli and Wegner state, “a language is object-oriented if and only if it satisfies the following requirements:

  • It supports objects that are data abstractions with an interface of named operations (procedure abstractions) and a hidden local state (encapsulation)
  • Objects have an associated type (class)
  • Types (classes) may inherit attributes from supertypes (superclasses)”

Also, it should be noted that if a language does not provide direct support for inheritance, then it is called object-based programming language.

Abstraction and Encapsulation can be easily achieved in C. Let us see how:

typedef struct student{

            int marks;                                            // integer data type
            char name[10];                                    // character data type

void ( *display ) ();                               // procedure abstraction
            void ( *enter ) ();                                  // procedure abstraction

} Student;                                                        // Encapsulation

Student *constructor(){

            Student *temp = ( Student *) malloc ( sizeof (Student) );

            temp->display = display;

            temp->enter    = enter;

            return temp;

};                                                                      // Constructor

int main (void) {

Student *student1 = constructor();     // Abstraction

(*student1).marks = 100;

return 0;

};

Inheritance is a little bit awkward in C as it follows a Top-Down Design rather than the commonly used Bottom-Ip Design method for object-orientation. For example, in C, it is the superclass that has the power to decide its inheritor whereas, in languages like C++, it is the sub-class that decides its superclass.

typedef struct Student{

            int Knowledge_level;                          

}Student;                                                                    

typedef struct Teacher{

Student *student1, *student2;

}Teacher;

C language thus fits well on the definition of OOL and as it’s faster, more stable and widely available, it can produce better code than most Object-Oriented Programming Languages. you “You can write object-oriented code (useful for filesystems etc) in C,  _without_ the crap that is C++.”

Dennis Ritchie was verily a scientist ahead of his times as even to this day, many modern languages borrow directly or indirectly from the concepts of C. Languages like C++, C#, Unix’s C shell, D, Go, Java, JavaScript (including transpilers), Limbo, LPC, Objective-C, Perl, PHP, Python, Rust, Swift, Verilog and SystemVerilog (hardware description languages), all have borrowed some or the other thing from the very C language.

According to the TIOBE index, C has always remained among the top choices for programming languages since its birth. However, Java did overtake it in the recent past but since the pandemic, it has once again started to lose its mojo. TIOBE stands for “The Importance Of Being Earnest” and the index provided by it is a standard indicator of the popularity of programming languages. According to the recent trends, C has once again surpassed Java due to the Coronavirus. The TIOBE says that languages like C have been “gaining popularity because these are used in software for medical devices.”

It is evident that this beautiful language that is solely for the passionate, is never going to lose its charm!

Amit Kumar
Author: Amit Kumar

Amit is the founder of YoursNews. This is a next generation blog, proved that blogging is an art; focus on valuable ideas and genuine stories, rest everything will fall into place.

Amit Kumar

Amit is the founder of YoursNews. This is a next generation blog, proved that blogging is an art; focus on valuable ideas and genuine stories, rest everything will fall into place.

Leave a Reply

Your email address will not be published.

Related Articles