History of Fundamentals in C
- Fundamentals in C is a basic computer programming language for other languages.
- C is a programming language developed at AT&T’s Bell Laboratory of USA in 1972.
- It was designed and written by Dennis Ritchie.
- Dennis Ritchie inherited the features of B and BCPL programming language added some features on his own and developed a language called C.
- Dennis Ritchie first implemented C on a DEC PDP-11 that used the UNIX Operating System.
- Brain Kernighan is the main contributor to designing the C language after Dennis Ritchie
Introduction of Fundamentals in C
- Language –
- A language is a mode of communication between two objects/people.
- It is necessary for those two objects/people to understand the language to communicate.
- If the two objects/people do not understand the same language of communication, a translator can help to convert one language to the other, understood by the second object/people.
Definition of C
- C is a standardized, industrial-strength, general-purpose, mid-level, procedural/structured programming language known for its power and portability.
Characteristics/Features of Fundamentals in C
- C lies in between low-level language and high-level language categories. That’s why it is often called a middle-level language. This is because it combines the elements of high-level languages with the functionality of assembly language. It provides relatively good programming efficiency (as compared to machine language) and relatively good machine efficiency (as compared to high-level languages). As a middle-level language, C allows the manipulation of bits, bytes, and addresses – the basic elements with which the computer executes the inbuilt and memory management functions. It binds the low-level and high-level programming languages. We can use C language as a System programming to develop the operating system as well as Application programming to generate a menu-driven customer-driven billing system.
- The main properties of the C programming language are –
- Simple – C is a simple language because it follows the structured approach, i.e., a program is broken into parts.
- Portability – Provides platform-independent feature i.e. the program is written and can be run on any machine with little or no modifications.
- Mid Level – C is a mid-level programming language as it combines the low-level language with the features of the high-level language.
- Modularity – Provides the possibility to break down large programs into small modules.
- Flexibility – Provides the possibility for a programmer to control the language.
- Speed – As we know C comes with support for system programming features and hence it compiles and executes with high speed when compared with other high-level languages. It is very fast as it uses a powerful set of data types and operators.
- Memory Management – C provides an inbuilt memory function that saves the memory and improves the efficiency of our program.
- Structured – C is a structured language as the C program is broken into parts.
- Extensibility – Provides to add new features by the programmer when needed.
- C supports several control structures such as while, do-while, and for and various data structures such as structures, files, arrays, etc.
- C is a case-sensitive language.
- All C programs consist of one or more functions. One compulsory function that must be present in every C program is main() function. This is the first function called up by the compiler when the program execution begins. Basically, main() is user user-defined function that outlines what a program does. Although the main is not given in the keyword list, it cannot be used for naming a variable. Every C program contains a function called main(). This is the starting point of the program. This is the point from where the execution begins.
- It is a robust language with a rich set of built-in functions and operators that can be used to write any complex program.
- The C compiler combines the capabilities of an assembly language with the features of a high-level language.
- Programs Written in C are efficient and fast.
- C is commonly referred to as the mother language as it is generally considered to be one of the most prominent programming languages. Since its development in 1972, it has gone on to become the most widely used programming language of all time. Most of the compilers, JVMs, and kernels in use today are written in C. Most of the languages which are developed after C language has borrowed heavily from it like C++, Python, Rust, javascript, etc. It introduces new core concepts like arrays, functions, and file handling which are used in these languages.
- They support extensive use of pointer implementation.
- C language has a variety of data types and powerful operators.
- C is a highly portable language. i.e. C programs written for one computer can easily run on another computer without any change or by doing a little change.
Advantage of C
- C source code is very portable, i.e. it allows the same C program to be run on machines with different hardware configurations.
- C is a very flexible language which is why it is used for systems programming as well as for application programming.
- C language is a building block for many other currently known languages.
Disadvantage of C
- It is a primitive programming language.
- Debugging is difficult.
- C compilers can only identify errors and are incapable of handling exceptions/run time errors.
- C doesn’t support Object Oriented Programming(OOP) features.
- It does not support constructor and destructor.
- C does not support for namespace like C++. Without Namespace, we cannot declare two variables of the same name.
Platforms, Editors, IDEs, and Compilers for Supporting or Writing and Executing C Program
A C program can be supported and executed by many application software, IDE, and platforms such as DOS, UNIX, Windows operating system, etc. These are –
- Platforms or Operating Systems for C :
It supports or provides environments to run editor and compiler programs for C programming.
-
- Windows:
- We can use Microsoft Windows as our development platform for C programming. Windows provides tools like Visual Studio,
- Visual Studio Code, Dev-C++, and Code::Blocks to write and execute C programs.
- macOS:
- macOS is Unix-based, making it a suitable platform for C development.
- Xcode, which is available on the Mac App Store, is a popular choice for macOS users for C programming.
- Linux:
- Linux distributions are widely used for C programming these days due to their Unix-like environment.
- We can use text editors like Vim, Emacs, Atom, or IDEs like Visual Studio Code, Eclipse CDT, or JetBrains CLion.
- Windows:
- Text Editor Applications (without built-in Compiler) for C :
These editors’ software are mainly used to write the codes for C programming. It does not support debugging, compilation, and execution of the C programs, rather it requires the compiler to be configured. These are –
-
- DOS Editor :
- DOS operating system stores C program with a file extension .c. Program code can be entered using any text editor but here it is DOS Editor, Unix or Linux Vi Editor, or any other specific compiler added with an editor such as Turboc2, Turbo C, Dev C++, Code Block, etc.
- UNIX/Linux Editor :
- UNIX or Linux operating system also stores C programs in a file extension .c. The program is written in Unix/Linux-specific text editors like vi, emacs, or xedit editor. To write/edit a C file in Unix/Linux, we use a popular specific editor called vi editor.
- NotePad/NotePad++ :
- Notepad or Notepad ++ is the simplest editor application for the C Program.
-
Visual Studio Code (VS Code) :
- Visual Studio Code is a lightweight yet powerful code editor developed by Microsoft, and available for Windows, macOS, and Linux.
- It supports a wide range of programming languages, including C, programming through extensions, and provides features like IntelliSense (code completion), debugging support, Git integration, customizable themes, a rich extension ecosystem, and version control integration.
- Website Link: Visual Studio Code
- Atom :
- Atom is a customizable text editor developed by GitHub.
- It supports C programming through plugins and offers features like syntax highlighting, code folding, Built-in package manager, Git integration, smart autocompletion, multiple panes, and a wide range of community-created packages, and multiple panes.
- In other words, it is highly extensible and has vibrant community-creating packages and themes.
- Available for Windows, macOS, and Linux.
- Website link : Atom
-
Sublime Text:
- Sublime Text is a popular text editor known for its speed and simplicity.
- It has a minimalist interface but is highly customizable through plugins.
- Multiple selections, split editing, command palette, customizable key bindings, and a rich plugin ecosystem.
- Available for Windows, macOS, and Linux.
- Website Link : Sublime Text
-
Emacs:
- Emacs is a powerful, extensible text editor with a long history.
- It is known for its extensive customization options and built-in support for many programming languages.
- Emacs is extensible with Lisp, syntax highlighting, built-in version control, powerful keyboard shortcuts, and a wide range of third-party packages.
- Available for Windows, macOS, and Linux.
- Website Link : GNU Emacs
-
Vim:
- Vim is a highly configurable, modal text editor that is widely used by programmers for its efficiency and speed.
- It has a steep learning curve but offers unparalleled productivity once mastered.
- Vim is a highly configurable text editor known for its efficiency and extensibility.
- It has built-in support for C programming and offers features like syntax highlighting, code folding, and powerful keyboard shortcuts.
- It has modal editing, powerful keyboard shortcuts, syntax highlighting, extensive plugin support, and scriptability.
- It is available for Windows, macOS, and Linux.
- Website link : Vim
- DOS Editor :
- Editor Applications (with built-in Compiler) for C
- This software comes with editors and compilers of specific (here C) programming languages mainly. This application is already configured for that particular computer language and hence no need to configure it again and can be used easily.
- For example – Turboc2, Turboc3, Turbo C, Dev C++, Code Block, etc.
- IDE for C :
Integrated Development Environments software comes with editors and compilers of different programming languages in an integrated form. for using it for a particular programming language, it must be configured properly.
-
- Visual Studio: Microsoft’s Visual Studio provides a comprehensive IDE for C programming on Windows. It offers features like IntelliSense, debugging, code refactoring, and more.
- Net Beans IDE: NetBeans IDE is a popular integrated development environment (IDE) primarily used for Java development, but it also supports several other programming languages, including C/C++. It provides a wide range of features to assist developers in writing, compiling, debugging, and deploying their applications efficiently.
- Xcode: Xcode is Apple’s integrated development environment for macOS. It provides tools for C programming along with support for Objective-C and Swift.
- CLion: CLion is a cross-platform IDE developed by JetBrains, suitable for C and C++ development. It offers code analysis, refactoring, debugging, and integration with version control systems.
- Eclipse CDT: Eclipse is a popular open-source IDE that supports various programming languages, including C. Eclipse CDT (C/C++ Development Tools) provides features like code completion, syntax highlighting, and debugging.
- Online C Compiler (with Editor) :
- Using this software, we can write, edit, debug, and execute the C program without installing it on the computer but it requires a high Internet connection to do that.
- Some popular Online C compilers are –
- Compilers for C :
- GCC (GNU Compiler Collection):
- GCC is a widely used compiler suite that supports C, C++, and other programming languages.
- It is available on various platforms, including Windows, macOS, and Linux.
- Clang:
- Clang is another popular compiler suite known for its fast compilation times and expressive diagnostics.
- It is part of the LLVM project and supports C, C++, and Objective-C.
- Microsoft Visual C++ Compiler:
- Microsoft’s Visual C++ compiler is commonly used for C programming on Windows.
- It is included with Visual Studio and can also be installed separately.
- GCC (GNU Compiler Collection):
Structure of a Typical C Program
Pre-processor directives(#) with header files
Global variable/data declarations /* if required */
returntype main ( ) /* main function*/
{ Variable declaration part; Input program statements;
Processing program statements;
Output program statements;
} /* User defined functions, if required */
func1( )
{ program codes/statements; } func2 ( ) { program codes/statements; } . . . func n ( ) { program codes/statements; } |
Execution of Fundamentals in C Program
A typical C program can be operated in the following steps –
Step1: Install an editor and configure it if required or an IDE application in the computer for C programming or use any online C compiler.
Step2: Write the C program code in the application.
Step3: Save it with a certain name with .C extension(say program1.C).
Step4: Compile it to check syntax errors, if any errors are found remove it and save it again. If no errors, Run it and get the Result.
Use/Applications of C
- To develop application software like databases and spreadsheets.
- It can be used to design the most complex system software like operating systems and compilers.
- It develops graphics-related applications like computer and mobile games.
- C language can evaluate any kind of mathematical equation.
- It is used to develop the core part of the UNIX operating system called Kernel.
- It can be used to design Network Devices.
- C‘ language is widely used in embedded systems
- It is widely used for developing desktop applications.
- Most of the applications by Adobe are developed using ‘C‘ programming language.
- It is used for developing browsers and their extensions.
0 Comments