GYAN PRAKASH

Web Developer

THE BIG QUESTION - WHY "C"?

When I started getting my interest in computers and their anatomy I felt like something magic was happening there, and then so many things affected me and I bend towards this field. Honestly, saying when I decided to learn Programming, the biggest question I ever faced was “From which language should I start?" So here in this blog i will express my ideas and experience about my first programming language i.e C.To a beginner programmer why C is language to choose from the mighty pool of 100 ’s of languages.

This was the question I asked myself when I started writing my first program. I tried many languages but finally I came to C, the most beautiful and charming language of all. I was literally blown away by the simplicity and elegance of C.

Though C is simple it is one of the most powerful languages ever created.

In this dynamic IT world new language come every day and then get obsolete, so there must be something in the C which has remained there for 3 decades and more, and even today there is hardly any language which can match its strength.

90% of the starting programmers say that C has been superseded by other languages such as C++, Java, and C # and so on, so why learn C. I don’t know why they think so but I know one thing that they will never excel the other 10% programmers who differs from this opinion.

C was the programming language developed at AT & T’s Bell Laboratories of USA in 1972. It was written by a man name Dennis Ritchie.

Now let us begin to analyze reason why C should be your first programming language.

1. I believe nobody can learn C++ or Java directly. To master these languages you need to have a strong concept of programming element such as polymorphism, classes, inheritance etc. Simple question is how you can learn such complicated concepts when you don’t even know about the basic elements such as block functions. C is a language which begins from scratch and it has foundational concepts on which today concepts stand on.

2. It is language on which C++ is based on, hence C# also derive its origin from the C. Java is also a distant cousin of C and share the same programming concept and syntax of C. These are the most dominant languages in the world and all are based on C. To rock the world through them you must get rocking with C.

3. C++, Java, and C # make use of OOP (Object Oriented Programming). Not all programs need it even though it is a powerful tool. Such programs are still written in C.

4.When ever it comes to performance (speed of execution),C unbeatable.

5. Major parts of the Windows, Unix and Linux are still written in C. So if you want program these OS or create your own you need to know C.

6. Device drivers of new devices are always written in C. The reason is that C provides you access to the basic elements of the computer. It gives you direct access to memory of your CPU through pointers. It allows you to manipulate and play with bits and bytes.

7. Mobiles, Palmtops, PDA’s etc are gaining popularity every second. Also appliances such as T.V., Refrigerators, and Microwaves etc. are becoming an integral part of our daily needs. You may not know but they have a CPU with them which do need programming and the software’s written for them are known as embedded system programs. These programs have to be fast in execution but also have a very little memory. No question why C is ideally suited for embedded system programming.

8. You must have played games on your PC. Even today these astounding 3D games use C as their core. Why? The simple reason who will play the game when it takes a lot of time fire a bullet after you have given command from the console. The reply to the command should be damn prompt and fast. Reply in 1 Nano second is an outstanding game; Reply in 10 Nano seconds is crap. Even today there is no match for C.

9. C is a middle level language. There are three types of language – High Level, Middle Level & Low Level. High level languages are user oriented, giving faster development of programs, example is BASIC. Low level languages are machine oriented; they provide faster execution of programs. C is a middle level language because it combines the best part of high level language with low level language. It is both user and machine oriented and provides infinite possibilities.

10. Last but not least it is a block structured language. The first symbol of a modern language is that it is block structured. Each code exists in separate block and is not known to code in other block providing easy means of programming and minimizing the possibilities of undesirable side effects. C is designed from the base to top to be a block structured language. Many older languages, most popular being BASIC tried to introduce this concept but their short coming can never fulfilled as they were never built along these line.



                                   /* Algorithm of Merge sort in C */

                                    $(/* C program for Merge Sort */
                                    #include
                                    #include
                                    
                                    // Merges two subarrays of arr[].
                                    // First subarray is arr[l..m]
                                    // Second subarray is arr[m+1..r]
                                    void merge(int arr[], int l, int m, int r)
                                    {
                                        int i, j, k;
                                        int n1 = m - l + 1;
                                        int n2 = r - m;
                                    
                                        /* create temp arrays */
                                        int L[n1], R[n2];
                                    
                                        /* Copy data to temp arrays L[] and R[] */
                                        for (i = 0; i < n1; i++)
                                            L[i] = arr[l + i];
                                        for (j = 0; j < n2; j++)
                                            R[j] = arr[m + 1+ j];
                                    
                                        /* Merge the temp arrays back into arr[l..r]*/
                                        i = 0; // Initial index of first subarray
                                        j = 0; // Initial index of second subarray
                                        k = l; // Initial index of merged subarray
                                        while (i < n1 && j < n2)
                                        {
                                            if (L[i] <= R[j])
                                            {
                                                arr[k] = L[i];
                                                i++;
                                            }
                                            else
                                            {
                                                arr[k] = R[j];
                                                j++;
                                            }
                                            k++;
                                        }
                                    
                                        /* Copy the remaining elements of L[], if there
                                        are any */
                                        while (i < n1)
                                        {
                                            arr[k] = L[i];
                                            i++;
                                            k++;
                                        }
                                    
                                        /* Copy the remaining elements of R[], if there
                                        are any */
                                        while (j < n2)
                                        {
                                            arr[k] = R[j];
                                            j++;
                                            k++;
                                        }
                                    }
                                    
                                    /* l is for left index and r is right index of the
                                    sub-array of arr to be sorted */
                                    void mergeSort(int arr[], int l, int r)
                                    {
                                        if (l < r)
                                        {
                                            // Same as (l+r)/2, but avoids overflow for
                                            // large l and h
                                            int m = l+(r-l)/2;
                                    
                                            // Sort first and second halves
                                            mergeSort(arr, l, m);
                                            mergeSort(arr, m+1, r);
                                    
                                            merge(arr, l, m, r);
                                        }
                                    }
                                    
                                    /* UTILITY FUNCTIONS */
                                    /* Function to print an array */
                                    void printArray(int A[], int size)
                                    {
                                        int i;
                                        for (i=0; i < size; i++)
                                            printf("%d ", A[i]);
                                        printf("\n");
                                    }
                                    
                                    /* Driver program to test above functions */
                                    int main()
                                    {
                                        int arr[] = {12, 11, 13, 5, 6, 7};
                                        int arr_size = sizeof(arr)/sizeof(arr[0]);
                                    
                                        printf("Given array is \n");
                                        printArray(arr, arr_size);
                                    
                                        mergeSort(arr, 0, arr_size - 1);
                                    
                                        printf("\nSorted array is \n");
                                        printArray(arr, arr_size);
                                        return 0;
                                    };
                                
                                 

Article By GYAN PRAKASH

Currently working with Shell script, MERN stack, React, Meteor, Typescript, Express Node, and Angular. Having experience with; - Javascript/Ajax,jQuery -NodeJs -Firebase -Python Extremely motivated to constantly develop my skills and grow professionally. I am confident in my ability to come up with interesting ideas for unforgettable marketing campaigns.