C Programming

Introduction to C

Basics of C

Control Flow

Arrays & Strings

User Input & Output

Pointers

Functions

File Handling

Structures, Unions & Enums

Memory Management

Error Handling & Debugging

Macros and Preprocessors

C Programming

Introduction to C

Basics of C

Control Flow

Arrays & Strings

User Input & Output

Pointers

Functions

File Handling

Structures, Unions & Enums

Memory Management

Error Handling & Debugging

Macros and Preprocessors

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


C Introduction Quiz

Q1: Who developed the C language?

A. James Gosling
B. Dennis Ritchie
C. Bjarne Stroustrup
D. Ken Thompson

Q2: What is the correct syntax to output "Hello World" in C?

A. echo("Hello World");
B. Console.Write("Hello World");
C. printf("Hello World");
D. cout << "Hello World";

Q3: Which of the following is a valid C keyword?

A. main
B. printf
C. return
D. include

Q4: Which function is the starting point of a C program?

A. start()
B. main()
C. init()
D. begin()

Q5: What symbol is used to include a header file?

A. #
B. $
C. @
D. *

Go Back Top