History

- **How**:
	- Developed by **Dennis Ritchie** in the early 1970s at **Bell Labs**.
	- Designed as an evolution of the B programming language, with the goal of providing more control over hardware and efficient system programming.
	- Became the foundation for many modern programming languages and operating systems.
	- Evolved through versions, with the ANSI C standard (C89) and the C99 standard being notable milestones.
	-
- **Who**:
	- **Dennis Ritchie**, a computer scientist, is the creator of C.
	- **Bell Labs**, the research lab at AT&T, where C was first developed.
	-
- **Why**:
	- To create a portable, efficient language that could be used for system programming and writing operating systems.
	- To provide low-level access to memory and hardware while maintaining readability and simplicity.
	- To enable the development of the **UNIX operating system**, which was one of its first major uses.

-

  • introduction

    • Advantages:

      • Performance and Control: C offers direct memory manipulation through pointers and manual memory management, making it highly efficient for system programming, embedded systems, and performance-critical applications. This level of control allows developers to fine-tune performance but requires careful handling.
      • Portability: C is platform-independent, with programs easily portable across different systems. It has been the foundation of many operating systems and compilers, ensuring that C code can run on almost any machine with minimal changes.
      • Simplicity and Efficiency: The language’s minimalistic syntax makes C easy to learn and use, focusing on low-level functionality and providing high efficiency in system-level applications. It’s often the language of choice for tasks like OS development and embedded systems.
      • Wide Use and Support: As one of the oldest and most widely used languages, C enjoys strong community support, vast resources, and a large library ecosystem, making it a dependable choice for many types of programming.
      • Low-Level System Programming: C is perfect for system-level programming (e.g., operating systems, device drivers) due to its ability to interact directly with hardware and manage system resources efficiently.
    • Disadvantages:

      • Manual Memory Management: Unlike modern languages with garbage collection, C requires developers to manually manage memory using malloc and free. This can lead to memory leaks or segmentation faults if not handled correctly.
      • No Object-Oriented Features: C is a procedural language, lacking native support for object-oriented programming concepts like classes, inheritance, and polymorphism, which makes it less suited for large, complex applications that benefit from these features.
      • Error Handling: C lacks built-in exception handling (e.g., try/catch), requiring manual checks (return codes, error flags) that can make error management cumbersome and more error-prone.
      • Complex Pointer Arithmetic: The heavy use of pointers in C, while offering power and flexibility, also introduces complexity. Improper pointer manipulation can result in hard-to-find bugs, such as buffer overflows or memory corruption.
      • Low-Level Nature: C’s focus on low-level operations means it’s less suitable for high-level tasks such as GUI development or applications requiring extensive built-in libraries and frameworks, which are easier to implement in higher-level languages like Python or Java.
      • Lack of Higher-Level Abstractions: While C is powerful, it lacks the advanced data structures and higher-level abstractions found in languages like C++ or Java, requiring more effort to implement features like dynamic arrays, complex data structures, or multithreading.
  • Notes

    • main() is the entry point of a C program.
    • printf("Hello World\n"); is used for printing output.
    • variables Types

      • Data format example : ~
    • Primitive Data Types

      • Data Types in Details : ~
      • Basic format specifiers : ~
    • User input string

    • Comments

    • Condition

    • C Important Tags

      • Control the number of spaces
      • Strings
      • Switch
    • pointer variable

    • Operators

      • Arithmetic Operators

        collapsed:: true
      • Assignment operator

        collapsed:: true
      • Comparison Operators

        collapsed:: true
      • Logical Operators

        collapsed:: true
      • Bitwise operators

        collapsed:: true
    • C Preprocessor

      • Preprocessor Directives

        collapsed:: true
      • Predefined macros

        collapsed:: true
      • Macro continuation operator ()

        collapsed:: true
    • C Function

      • Function declaration and definition

        collapsed:: true
      • Call function

        collapsed:: true
        • Function parameters

          collapsed:: true
        • Multiple parameters

          collapsed:: true
        • Return value

          collapsed:: true
        • Recursive example

          collapsed:: true
        • Mathematical functions

          collapsed:: true
      • Function parameters

        collapsed:: true
      • Multiple parameters

        collapsed:: true
      • Return value

        collapsed:: true
      • Recursive example

        collapsed:: true
      • Mathematical functions

        collapsed:: true
      • Return value

        collapsed:: true
    • C Structures

      • Create structure

        collapsed:: true
      • Strings in the structure

        collapsed:: true
      • Accessing structure members

        collapsed:: true
      • Copy structure

        collapsed:: true
      • Modify value

        collapsed:: true
    • file processing

      • File processing function

      • Open mode parameter

        collapsed:: true
  • Library & Frameworks

    • GLib - Core library for C with data structures, utilities, and threading.
    • GTK - GUI toolkit for creating graphical user interfaces.
    • libcurl - Library for transferring data with URLs (HTTP, FTP, etc.).
    • OpenSSL - Cryptography and SSL/TLS protocols.
    • SQLite - Lightweight, self-contained SQL database engine.
    • libxml2 - XML parsing and manipulation.
    • ncurses - Library for text-based interfaces and terminal handling.
    • SDL - Multimedia library for graphics, sound, and input handling in games.
    • pthread - POSIX threads library for multithreading support.
    • libevent - Event notification library for asynchronous I/O.
    • jansson - JSON library for encoding and decoding.
    • zlib - Data compression library.
  • More Learn