0% found this document useful (0 votes)
4 views

Introduction To C Programming

Uploaded by

Murugan P
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)
4 views

Introduction To C Programming

Uploaded by

Murugan P
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/ 14

Introduction to C Programming

Introduction to C Programming
• Agenda for Section 1:

• Introduction to Programming and C Language


• Basic Structure of a C Program
• Data Types and Variables in C
• Input and Output Functions in C
• Summary and Key Takeaways

2
Introduction to Programming and C Language
• What is Programming?

• Communicating with computers using programming languages.


• Low-level vs. High-level languages.
• Importance of C as a foundational language.

• History of C Language

• Developed by Dennis Ritchie in 1972.


• Designed for portability and efficiency.
• Widely used in systems programming, embedded systems, and
more
3
Introduction to Programming and C Language
• Setting Up the C Programming Environment

• Install a C compiler (GCC).


• Use an IDE like Code::Blocks or Dev C++.
• Write and run your first C program.

4
Basic Structure of a C Program
• The Structure of a C Program
• Preprocessor directives (#include <stdio.h>).
• Main function: int main().
• Output using printf().
• Example: "Hello World" Program.

• Example: "Hello World" Program

#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
} 5
Basic Structure of a C Program
• Key Components of a C Program

• Preprocessor Directive: Includes libraries.


• Main Function: Entry point of the program.
• Return Statement: Ends the program.

• Compilation and Execution Process

• Compilation Steps
• Preprocessing.
• Compilation.
• Assembly.
• Linking to generate an executable file. 6
Basic Structure of a C Program
• Comments in C

• Types of Comments
• Single-line comments: // Comment.
• Multi-line comments: /* Comment */.
• Used for code documentation and clarity

7
Data Types and Variables in C
• Data Types in C

• int: Integer numbers.


• float: Decimal numbers.
• double: Double precision floating-point numbers.
• char: Single characters.

• Declaring and Initializing Variables

• Declare a variable: int a;.


• Initialize a variable: int a = 10;.
8
Data Types and Variables in C
• Constants and Literals

• Integer literals (e.g., 10).


• Floating-point literals (e.g., 3.14).
• Character literals (e.g., 'A').
• String literals (e.g., "Hello").

9
Input and Output Functions in C
• Input/Output in C

• printf(): Displays output.


• scanf(): Accepts user input.
• Format specifiers: %d (integer), %f (float), %c (character).

10
Input and Output Functions in C
• Example Program: Input/Output

#include <stdio.h>
int main() {
int a;
printf("Enter a number: ");
scanf("%d", &a);
printf("You entered: %d", a);
return 0;
}

11
Summary and Key Takeaways
• Summary of Section 1

• Basic understanding of C program structure.


• Data types and variable declaration.
• How to take user input and display output.
• Steps of compiling and running a C program.

12
Summary and Key Takeaways
• Key Takeaways

• C is foundational for understanding programming concepts.


• Understanding the structure of a C program is key.
• Practicing data types, variables, and input/output functions is
essential for further learning.

13
Thank You!

You might also like