Introduction to C Programming

Overview

C is a general-purpose programming language known for its efficiency, flexibility, and close interaction with computer hardware. Originally designed by Dennis Ritchie in 1972 at Bell Labs, USA, C has become a fundamental component of modern computing, powering everything from embedded systems and operating systems to high-performance applications.

Advantages and Disadvantages

Advantages of C LanguageDisadvantages of C Language
- Exceptional performance and efficiency- Lack of object-oriented features
- Widespread compatibility and portability- Limited support for avoiding namespace collisions
- Low-level access and close proximity to hardware- No garbage collector
- Ideal for developing operating systems- Limited support for polymorphism
- Efficient memory management and speed- Limited support for exceptions

Program Structure

A program is a set of logically grouped instructions that are executed sequentially.

Compilation Process

High-Level Code -> Compiler -> Assembly -> Assembler -> Machine Code (input/output)

Software

Software is a collection of programs categorized into:

  1. Application Software: Programs designed according to specific needs/utilities (e.g., Games, Antivirus, MS Office).
  2. System Software: Essential for proper computer functioning (e.g., Operating Systems, Linkers, Loaders).

Software Portability

C is hardware portable but not software portable.

Compilation Steps

  1. Source Code (.c): Written in C programming language.
  2. Object Code: Generated by the compiler.
  3. Linking: Object code linked with libraries by the linker (system software).
  4. Executable File: Ready for execution.
  5. Loading: Executable file loaded from hard disk to RAM by the loader.