besidedegree@gmail.com
+9779709005491
Enquiry
Back to Home
School SEE Computer Science

Grade 10 ||Structured Programming in c|| Notes

Highlight Save
Computers cannot perform any task on their own. They need a set of instructions known as a program. A collection of programs forms software. Programs can be written using different languages and different approaches, among which structured programming is one of the most important. Structured programming follows a top-down method, where a complex program is broken into smaller modules. Each module performs a specific part of the task, making the program easier to design, understand and debug. It uses three basic control structures: sequence, selection and loop. These structures ensure that each module has a single entry and a single exit point, improving clarity and reducing errors. C language is a high-level structured programming language developed by Dennis Ritchie in the early 1970s. Although originally designed for system programming under UNIX, it became widely used due to its speed, flexibility and powerful features. C programs are divided into functions, which helps in organizing code efficiently. C supports various data types such as int, float, double and char. It also includes operators for arithmetic and logical operations, and uses format specifiers with input/output functions like printf() and scanf(). Programs in C follow specific steps: writing the source code, compiling it, linking required libraries and finally running the executable file. Because of its efficiency and control over hardware, C is used in operating systems, compilers, device drivers, editors, network programs, and many modern utilities. Even with limitations like no runtime type checking or lack of object-oriented features, C remains one of the most influential programming languages.

1. Introduction to Programming

A computer is a fast, accurate machine, but it can’t think. It waits for humans to give step-by-step instructions. These instructions are called a program, and the person who writes them is a programmer.

A set of programs that helps a computer work is called software. To write programs, we use special languages called programming languages. Just like humans use Nepali or English to talk, computers use languages like C, Java or Python.

2. Types of Programming Languages

a) Machine Language

The oldest, most basic language.

Written using 0s and 1s.

Fastest for the computer but painfully difficult for humans.

b) Assembly Language

  • Uses short words called mnemonics (e.g., MOV, ADD).
  • Easier than machine language but still low-level.
  • Needs an assembler.

c) High-Level Language

Looks more like English.

Easy to write and understand.

Examples: C, Java, Python.

Needs translation:

Compiler

Interpreter

3. Approaches to Programming

To solve problems using a computer, programmers follow some methods.

i. Unstructured Programming

  • Everything is written in one long program.
  • Uses many jumps (GOTO statements).
  • Hard to understand, maintain or debug.

ii. Structured Programming

This is the hero of the chapter.
It breaks the problem into smaller parts called modules.

Features

  • Top-down approach
  • Uses three main structures:
  • Sequence (step-by-step)
  • Selection (if-else)
  • Loop (repeat until condition is met)
  • Makes programs easy to read, test and update.

Advantages

  • Less errors
  • Easier to understand
  • Easier to reuse parts
  • Good for team programming

4. Levels of Programming Languages

Programming languages are divided into levels:

a) Lower-Level Languages

Machine and Assembly language

Fast but hard for humans

b) Middle-Level Languages

Provide some low-level control but easier than assembly

Example: C language

c) High-Level Languages

Easy to read and write

Example: Python, Java, C++

5. Introduction to C Language

C is a high-level programming language created by Dennis Ritchie at Bell Laboratories in 1972.

Why is C so popular?

  • Fast and powerful
  • Can access memory and hardware
  • Used to build operating systems
  • Portable (runs on many computers)
  • Structured (supports modular programming)

Where is C used today?

  • Operating systems (like UNIX parts)
  • Compilers
  • Device drivers
  • Embedded systems
  • Scientific and engineering applications

6. Features of C Language

  • Simple
  • Fast execution
  • Portable (runs on many computers)
  • Structured language
  • Middle-level language
  • Rich set of operators
  • Extensible (allows user-defined functions)
  • Efficient memory management

7. Structure of a C Program

A C program always follows a specific pattern.

Parts of a C Program

1. Header files

Tell the compiler what libraries you want to use.

#include

2. main() function

Where the program starts running.

3. Variables

Containers to store data.

4. Statements

Commands that the computer executes.

5. Braces { }

Define the beginning and end of blocks.

8. Data Types in C

To store different kinds of data, C uses data types.

Data TypeSizeExampleint2 or 4 bytes4, 100, -5float4 bytes2.5, 9.81double8 bytes3.1415926char1 byte'A', 'b'

9. Variables and Constants

Variables

Names used to store values that can change.

Example:
int age = 18;

Rules for naming variables

Start with letter or underscore

No spaces

No special symbols

Case-sensitive

Constants

Values that do not change.

Example:
const float PI = 3.14;

10. Operators in C

Operators perform calculations.

a) Arithmetic

+, -, *, /, %

b) Relational

==, !=, >, <, >=, <=

c) Logical

&&, ||, !

d) Assignment

=, +=, -=, *=

11. Input and Output in C

Output: printf()

Used to display data.

Example:
printf("Hello World");

Input: scanf()

Used to get user input.

Example:
scanf("%d", &age);

Format Specifiers

TypeSpecifierint%dfloat%fdouble%lfchar%c

12. Compilation Process in C

Steps from writing to running:

Editing
– Write the program

Compiling
– Convert C code into machine code

Linking
– Link library files

Execution
– Run the final output program

13. Basic Example Program

14. Applications of C Language

C is used in:

  1. Operating system development
  2. Database systems
  3. Network drivers
  4. Embedded microcontroller programs
  5. Compilers and interpreters
  6. Robotics
  7. Game engines

15. Limitations of C Language

  1. Even superheroes have weaknesses.
  2. No built-in graphics support
  3. No object-oriented features
  4. No automatic garbage collection
  5. Harder for beginners to master pointers

16. Why Students Should Learn C

  1. Builds strong foundation
  2. Helps understand how computers work internally
  3. Useful for advanced languages like C++, Java, Python
  4. Almost every engineering and CS course starts with C

Gallery

Types of Programming Languages
Types of Programming Languages
Approaches to Programming
Approaches to Programming
Structured Programming Flow
Structured Programming Flow
Top-Down Design
Top-Down Design
Levels of Programming Languages
Levels of Programming Languages
Structure of a C Program
Structure of a C Program
Compilation Process in C
Compilation Process in C
Data Types in C
Data Types in C
Structure of a Function in C
Structure of a Function in C
Input/Output in C
Input/Output in C

Related Videos

Structured Programming in C by Readers Nepal

Important Links