C Introduction


🔹 What is C?

C is a powerful general-purpose programming language. It is widely used to develop system software, databases, operating systems, embedded systems, and more.

It was developed in the 1970s by Dennis Ritchie at Bell Labs and remains the foundation of many modern languages like C++, Java, and Python.


🔹 Why Learn C?

  • Simple and fast

  • Portable and efficient

  • Gives low-level access to memory

  • Suitable for system-level programming

  • Forms the base of modern programming languages


🔹 Features of C

  • Procedural language

  • Rich library of functions

  • Modular structure with functions

  • Compiled language (requires compilation before running)


🔹 How to Get Started with C?

To write and run C programs:

✅ You Need:
  • A C compiler like GCC or Turbo C

  • A text editor (Code::Blocks, Visual Studio Code, etc.)

✅ Basic C Program Structure:
#include <stdio.h>

int main() {
    printf("Hello, World!");
    return 0;
}
 
🔸 Explanation:
  • #include <stdio.h> — Includes standard input/output header

  • int main() — Starting point of execution

  • printf() — Prints output

  • return 0; — Ends the program


🔹 Compiling and Running a C Program

✅ Using GCC:
gcc program.c -o program
./program

Practice Questions

Q1. Print your name using C.

Q2. Add two numbers.

Output: Sum = 8

Q3. Use comments in C.

Q4. Input a number and print it

Q5. Multiply two floating-point numbers.

Output: Product = 10.00


Go Back Top