Introduction to C Programming Language
In this article, I am going to give you a brief introduction to the C Programming Language. Please read our previous article where we discussed what is program and programming in detail. As part of this article, I am going to discuss the following pointers in detail.
- What is C Language?
- Why C execution is faster?
- Is C platform-dependent?
- Why C?
- Is C preferred for competitive programming?
- Why C Language Becomes very Popular:
- Advantages and Disadvantages of C.
- Applications of C Language.
- Features of C Programming Language.
- Characteristics of C Language
- How does C Program work?
What is C Language?
The C Programming Language is a High-Level procedure-oriented structured programming language. Programming Language which is syntactically similar to English and easy to understand is called High-Level Programming Language. When programming language supports module or function implementation then it is called Procedure Oriented Language. Programming Language which follows the TOP-DOWN approach in the form of blocks is called Structured Programming Language.
C is a general-purpose, high-level evergreen and non-exhaustive programming language that was originally developed by Dennis M. Ritchie in the year 1972 to develop the UNIX operating system at Bell Labs. It is one of the most simple, popular, and flexible programming language. It was derived from B language.
It is a machine-independent, structured programming language which is used extensively nowadays to develop various types of applications.
Why C language execution is faster?
The C Programming language execution is faster as compared to other high-level programming languages such as Java or C#. The reason is, C language doesn’t require the abstraction layer such as JVM (Java Virtual machine in Java) or CLR (Common Language Runtime in C#). C language directly is compiled and executed on top of the operating system.
Is C programming language platform-dependent?
The c programs are platform-independent but c executable files are platform-dependent. That means you can write a C program on any platform and can also compile it anywhere. But, once you generate executable files on one platform then you can not run that executable files on other platforms. For example, if you generate the executable files on windows, then you can run only those files on the Windows Operating system but on Linus or any other operating system. You need to re-compile the same program in Linus or any other operating system to get that particular operating system executable files.
Why to Learn C Language?
The Programming Language C was highly recommended for beginners as it is the base language for many other programming languages. Again C was recommended to understand the basic programming concepts such as data types, operators, control statements, and many more in a clear and precise manner. The Syntax and semantics of the C language were easy to understand and nearly the same as widely used modern programming languages such as C++, Java, and C#. So, learning ‘C’ as the main language will play an important role while studying other programming languages.
Is C preferred for competitive programming?
Yes, In recent years competitive programming (Codechef, HackerRank, TopCoder, SPOJ) gained huge popularity among young programmers. Companies such as Amazon, Google, Microsoft, Facebook wants a programmer to be good at Data Structures and Algorithms.
C++ the successor of C language is highly recommended for competitive programming because, In competitive programming, high priority will be given to both space and time complexity.
C++ runs a bit faster when compared to modern programming languages. C++ is one level abstraction to C. So as I said earlier if you know C then coding in C++ is not a big challenge.
Why C Language Becomes Very Popular?
- It is one of the legacy programming languages and you can learn it quickly.
- The C language is reliable, flexible, simple, and most importantly easy to use.
- It is based on the structured language.
- The C language considered as the mother of all other programming languages.
- Most of the Modern programming concepts are inherited from the C language.
- In most of the Universities, they preferred to add C programming in their courseware.
Advantages of C Language:
- Platform Dependent: As we copy the .exe file to any other computer which contains windows OS then it works properly because native code is the same. But when the same .exe file if we are copying to any other computer which contains UNIX/LINUX OS then it doesn’t work because native code is different. This behavior is called Platform Dependency.
- Portability: We can carrying the instruction from one system to another system.
- Easy: C Language code or syntax is very easy to understand. It uses a keyword like if, else, switch, main, etc. This kind of keyword we all are using in our day to day life to get some decisions.
- Fast: C compiler is very fast as compared to other language compilers. C compiler can compile around 1000 lines of code in a second. It is more efficient than unstructured code because of the minimized branching of the code.
- Readability: Maintenance of the C code is easy due to the readability of the code.
- Secured: C program is secured.
Disadvantages of C Language:
- C does not have the OOPS feature that’s why C++ is developed.
- There is no runtime checking in C Programming Language.
- There is no strict type checking (for example we can pass an integer value for the floating data type).
- As the program extends it is very difficult to fix the bugs.
- C doesn’t have the concept of the namespace, constructors and destructors, Inheritance, Polymorphism, Abstraction, and Encapsulation like Object-Oriented Programming Language (OOPS).
What are the applications of C Language?
- C is used to develop a System software applications like UNIX, WINDOWS, LINUX, and COMPILER DESIGNING.
- C is also used in the development of many applications like commercial products.
- C is used in the development of Embedded and Mobile Apps.
- C Language has good interaction with Hardware.
- Graphic Frameworks for mobile and PC games are developed using C Language.
Features of C Programming Language
It is a very simple and easy language, C language is mainly used for developing the desktop-based application. All other programming languages were derived directly or indirectly from C programming concepts. This language has the following features:
- Platform Dependent
- Structure Oriented
- Case Sensitive
- Compiler based
- Middle-level language
- Syntax based language
- Use of Pointers
Characteristics of C Language
- C supports 44 Operators, 32 Keywords, and 14 Separators.
- C is a Case Sensitive Language.
- Every C statement ends with a semicolon (;).
- C language supports a large set of library functions.
- C is a Function Oriented, Procedure Oriented, and Structure Oriented Programming Language.
How does C Program work?
- First, the source code is formed or created (through vi or cd command in UNIX). It is saved with an extension .c, which is known as the source file. For example ked.c
- The second step is to compile the source code, to check for existing errors (through cc command in UNIX or through Alt+F9 in Turbo C). After compilation, if it is free from errors then the object file is generated, which has the extension .o (in UNIX) or .obj (in Turbo C).
- Next step is to link the file to existing files (which is automatically done after compilation in UNIX), which generates the executable files .exe (in Turbo c) or stored in a.out (in UNIX, that always gets overwritten, which can be avoided by renaming the file a.out to some other name).
- The last step is to run or execute the program (through ./a.out in UNIX or through Ctrl+F9 in Turbo C).
In the next article, I am going to discuss the History and Evolution of C Language. Here, in this article, I try to give an overview of C Language and I hope you enjoy this article. I would like to have your feedback. Please post your feedback, question, or comments about this article.