Basics Before Coding in C
Introduction for Fresher's - C Programming Lab
Session No.:Lab Session 1
Course Name : Programming for problem-solving using C
Course Code: RIUC101B
Instructor Name: Prabhakaran M
Duration: 50 minutes
Date of Conduction of Class: X/08/2025
Galgotias University 1
OPENING QUESTION
Have you heard of any programming languages before? Which
ones?
2
OPENING QUESTION
C is more than 50 years old — why do you think we still learn it today?
3
At the end of this session students will be able to
Learning Outcome
Develop confidence to write and run their first C program.
Galgotias University 4
1 What is C?
2 Steps in Writing a Program
Session 3 Structure of a C Program
Outline 4 Key Rules in C
5 Summary
Galgotias University 5
What is C?
A general-purpose programming language
Fast, simple, and close to hardware
Used in Operating Systems, Embedded Systems, Games,
and Applications
6
Steps in Writing a Program
1.Write code in editor/IDE
2.Save with .c extension (e.g., hello.c)
3.Compile → converts code to machine language
4.Run → executes the program
7
Structure of a C Program
Every program must have main() function 8
9
Example
Program
10
Learning Activity : THINK-
PAIR SHARE
Think: Look at each C program and identify its sections
(Documentation, Link, Definition, Global Declaration, main(),
Subprogram).
Pair: Discuss your identification of the program sections with a
partner and compare answers.
Share: Summarize the structure of a C program based on your
discussion.
11
Reflection on Post session
12
Key Rules in C
Every C program starts with main() functionExecution begins from main().
Statements end with a semicolon ;Example: printf("Hello");
Curly braces { } define blocksUsed for grouping statements in functions, loops, etc.
Case-sensitive languagemain and Main are different.Header files must be included
Example: #include <stdio.h>
Comments Single line: // commentMulti-line: /* comment */
Variables must be declared before useExample: int num;
Return statement in main()return 0; indicates successful execution.
13
Summary
Every C program starts with a Documentation Section (comments about the program).
Link Section includes libraries like <stdio.h> for input/output.
Definition Section is used to define constants with #define or const.
Global Declaration Section declares variables or functions usable throughout the
program.
main() Function Section is mandatory and contains local declarations and executable
statements.
Subprogram Section (Functions) contains user-defined functions to organize code
efficiently.
Galgotias University 14
The structure ensures programs are readable, organized, and maintainable.
Ensure attainment of LOs in
alignment to the learning
activities: outcomes (1-2)
Outcome 1: Students individually think about a C
program, discuss their ideas in pairs, and share results to
build confidence in writing and running their first C
program.
Galgotias University 15
THANK YOU !
Galgotias University 16