0% found this document useful (0 votes)
3 views15 pages

Basic C Programming For Beginners

This document is an introductory guide to C programming, covering its history, features, basic syntax, data types, variables, input/output, operators, decision making, and loops. It provides examples of simple C programs and instructions on how to compile and run them. The document emphasizes the ease and power of C, encouraging practice with real-world applications.

Uploaded by

Sindhuja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views15 pages

Basic C Programming For Beginners

This document is an introductory guide to C programming, covering its history, features, basic syntax, data types, variables, input/output, operators, decision making, and loops. It provides examples of simple C programs and instructions on how to compile and run them. The document emphasizes the ease and power of C, encouraging practice with real-world applications.

Uploaded by

Sindhuja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

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! 💻

You might also like