Professional Documents
Culture Documents
Semester-1!22!23-Introduction To C Programming
Semester-1!22!23-Introduction To C Programming
Objectives
❏ To understand the structure of a C-language program.
❏ To write your first C program.
❏ To introduce the include preprocessor command.
❏ To be able to create good identifiers for objects in a program.
❏ To be able to list, describe, and use the C basic data types.
❏ To be able to create and use variables and constants.
❏ To understand input and output concepts.
❏ To be able to use simple input and output statements.
1
Background
2
C Programs
3
Structure of a C Program
4
The Greeting Program
5
The Greeting Program
6
Examples of Block Comments
7
Examples of Line Comments
8
Identifiers
9
Rules for Identifiers
10
Note
C is a case-sensitive language.
11
Examples of Valid and Invalid Names
12
Data Types
13
Character Types
14
Integer Types
15
Note
sizeof (short) ≤ sizeof (int) ≤ sizeof (long) ≤ sizeof (long long)
16
Typical Integer Sizes and Values for Signed Integers
17
Floating-point Types
18
Note
sizeof (float) ≤ sizeof (double) ≤ sizeof (long double)
19
Type Summary
20
Variables
21
Variables
22
Examples of Variable Declarations and Definitions
23
‘B’
Variable Initialization
24
Constants
25
Symbolic Names for Control Characters
26
Examples of Integer Constants
27
Examples of Real Constants
28