User:Saroj Neupane Lesson Plan 8

Revision as of 09:20, 4 December 2023 by Saroj Neupane (talk | contribs)

Subject : Computer Science

Period: 3rd

Topic: Array in C Programming

School: ABC School

Class: 10

Unit: Seven

Time: 15 min

No. of Students: 20

Specific Objectives

By the end of this brief lesson, students should be able to:

  • Understand the concept of arrays in C programming.
  • Declare, initialize, and access elements in an array.

Teaching Materials

  • Whiteboard and markers
  • Quick access to a C compiler for live coding demonstration

Teaching Learning Activity

Introduction (3 minutes):

  • Briefly review the concept of variables.
  • Introduce the need for handling multiple values efficiently.
  • Explain that arrays are collections of similar elements stored in contiguous memory locations.
  • The array is the simplest data structure where each data element can be randomly accessed by using its index number.

Declaration and Initialization (5 minutes):

  • Show the syntax for declaring an array and initializing it.
  • Syntax: data_type array_name[array_size]; //Declaration of array Example: int marks[5];
  • marks[0]=80;//initialization of array
  • marks[1]=60;
  • marks[2]=70;
  • marks[3]=85;
  • marks[4]=75;
  • Declaration with Initialization:
  • int numbers[5] = {1, 2, 3, 4, 5};

Accessing Array Elements (3 minutes):

  • Explain how to access individual elements using index notation.

int x = numbers[2]; // Access the third element (index 2) of the array


Code Demonstration (4 minutes):

Quickly demonstrate a simple code example on the whiteboard.

  1. include <stdio.h>

int main() {

   int numbers[5] = {1, 2, 3, 4, 5};
   for (int i = 0; i < 5; i++) {
       printf("Element %d: %d\n", i, numbers[i]);
   }
   return 0;

}

Conclusion (2 minutes):

  • Summarize the key points: Arrays store multiple values of the same type.
  • Encourage students to practice declaring, initializing, and accessing arrays.

Evaluation

  • What is array? How to declare and initialize array in c?
  • Write simple program of array in c ?