C Programming for Beginners
• Learn the Basics of C in Simple English
• Presented by: Your Name / College /
Department
Introduction to C
• • C is a powerful and widely-used
programming language.
• • Developed by Dennis Ritchie in 1972 at Bell
Labs.
• • Used for system software, embedded
systems, and game programming.
Features of C Language
• • Fast and efficient
• • Middle-level language
• • Structured programming
• • Rich set of built-in functions
• • Portable across platforms
Structure of a C Program
• #include <stdio.h>
• int main() {
• printf("Hello, World!");
• return 0;
• }
• Explanation:
• • #include <stdio.h> – header file
• • main() – entry point
Basic Syntax
• • Every C statement ends with a semicolon ;
• • Code is written inside { }
• • Use // or /* */ for comments
• Example:
• int a = 5; // This is a comment
Data Types in C
• Data Type | Size | Example
• int | 2/4B | int age = 20;
• float | 4B | float pi = 3.14;
• char | 1B | char grade = 'A';
• double | 8B | double d = 3.14159;
Variables and Constants
• • Variable: A container to store data
• Example: int a = 10;
• • Constant: Value that does not change
• Example: const float pi = 3.14;
Input and Output
• • scanf() – to take input
• • printf() – to display output
• Example:
• int a;
• scanf("%d", &a);
• printf("Value: %d", a);
Operators in C
• • Arithmetic: +, -, *, /, %
• • Relational: ==, !=, <, >, <=, >=
• • Logical: &&, ||, !
• • Assignment: =, +=, -=, etc.
Decision Making (if, else)
• if (a > b) {
• printf("A is greater");
• } else {
• printf("B is greater");
• }
Loops in C
• • for loop:
• for(int i=0; i<5; i++) {
• printf("%d", i);
• }
• • while loop:
• int i=0;
• while(i<5) {
• printf("%d", i);
Simple C Program Example
• #include <stdio.h>
• int main() {
• int a, b, sum;
• a = 5;
• b = 10;
• sum = a + b;
• printf("Sum = %d", sum);
• return 0;
• }
Compile and Run
• • Write code in .c file
• • Compile: gcc program.c
• • Run: ./a.out
Summary
• • C is easy and powerful
• • Learn syntax, variables, operators
• • Practice with simple programs
• • Useful in many real-world applications
Thank You
• Questions?
• Happy Coding! 💻