Docsity

C lesson plan, Study Guides, Projects, Research of Computer science

Toggle sidebar
bg1
Step1: go to the class with confidence and say Morning to the class.
Step2: Introduce yourself.
Step 3: Then take the previous knowledge test
Ask these questions:
1): What is a computer Program?
2)What is a programming language?
3) What is a low level language?
4) What is High level language?
5) What about C ? is it low level language or high level language?
Students will give different answers.
Step4: Now announce the topic
Students today we will learn about C, its history and basic syntax.
Step 5: Presentation
•C programming language
•C is developed by Dennis Ritchie
•C is a structured programming language
•C supports functions that enables easy maintainability of code, by
breaking large file into smaller modules
•Comments in C provides easy readability
•C is a powerful language.
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download C lesson plan and more Study Guides, Projects, Research Computer science in PDF only on Docsity!

Step1: go to the class with confidence and say Morning to the class.

Step2: Introduce yourself.

Step 3: Then take the previous knowledge test

Ask these questions:

1): What is a computer Program?

2)What is a programming language?

3) What is a low level language?

4) What is High level language?

5) What about C? is it low level language or high level language?

Students will give different answers.

Step4: Now announce the topic

Students today we will learn about C, its history and basic syntax.

Step 5: Presentation

  • C programming language
  • C is developed by Dennis Ritchie
  • C is a structured programming language
  • C supports functions that enables easy maintainability of code, by

breaking large file into smaller modules

  • (^) Comments in C provides easy readability
  • C is a powerful language.
  • C programs built from
    • Variable and type declarations
    • Functions
    • Statements
    • Expressions

A Brief History of C

C is a general-purpose language which has been closely associated with the UNIX operating system for which it was developed - since the system and most of the programs that run it are written in C.

Many of the important ideas of C stem from the language BCPL , developed by Martin Richards. The influence of BCPL on C proceeded indirectly through the language B , which was written by Ken Thompson in 1970 at Bell Labs, for the first UNIX system on a DEC PDP-7. BCPL and B are "type less" languages whereas C provides a variety of data types.

In 1972 Dennis Ritchie at Bell Labs writes C and in 1978 the publication of The C Programming Language by Kernighan & Ritchie caused a revolution in the computing world.

In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or "ANSI C", was completed late 1988.

Why use C?

C has been used successfully for every type of programming problem imaginable from operating systems to spreadsheets to expert systems - and efficient compilers are available for machines ranging in power from the Apple Macintosh to the Cray supercomputers. The largest measure of C's success seems to be based on purely practical considerations:

  1. the portability of the compiler;
  2. (^) the standard library concept;
  3. a powerful and varied repertoire of operators;
  4. an elegant syntax;
  5. ready access to the hardware when needed;
  • This is the entry point of a program
  • When a file is executed, the start point is the

main function

  • From main function the flow goes as per the

programmers choice.

  • There may or may not be other functions written

by user in a program

  • Main function is compulsory for any C program

Running a ‘C’ Program

  • Type a program
  • Save it
  • Compile the program – This will generate an exe

file (executable)

  • Run the program (Actually the exe created out of

compilation will run and not the .c file)

  • In different compiler we have different option for

compiling and running. We give only the concepts.

C language Tokens

  • What are actually tokens?
  • The smallest individual units in a C program are

known as tokens. In a C source program, the

basic element recognized by the compiler is the

"token." A token is source-program text that the

compiler does not break down into component

elements.

Token types in ‘C’

  • C has 6 different types of tokens viz.
  1. Keywords [e.g. float, int, while]
  2. Identifiers [e.g. main, amount]
  3. Constants [e.g. -25.6, 100]
  4. Strings [e.g. “SMIT”, “year”]
  5. Special Symbols [e.g. {, }, [, ] ]
  6. Operators [e.g. +, -, *]

C programs are written using these tokens and the

general syntax.

if

break

case

char

const

continue

default

do

register

return

short

signed

sizeof

static

struct

int

switch

typedef

union

unsigned

void

volatile

while

long

Step 6: Ending the lesson

Step7: Recap

  1. Who invented C? and When?
  2. Why we use C?
  3. What is a Header file in C?