0% found this document useful (0 votes)
9 views14 pages

Chapter 01

Uploaded by

ramiomar199
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views14 pages

Chapter 01

Uploaded by

ramiomar199
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

1 The development of Programming 1960

language Algol-60
1950
Fortran 1963
CPL
1960 Algol-60 Cobol 1967
CPL BCPL
Simula BCPL
1970
1970 Pascal B
B
Smalltalk
C 1972
1980 Ada C

C++ 1985
ANSI C
1990 C++1
Java
Overview of C Language
1
ü Small size
ü C is modular
ü Loose typing
ü Structured language
ü Low level programming readily available
ü C has a very powerful set of operators
ü Rich data structure
ü C efficient on most machines

2
The Program Framework of C Language
The Program Framework of C Language
What should I do if there is an error in the
program?
Overview of C Language

1C Program Structure

program functions statements expressions

Characters Operands +
operators

6
1 Essential Elements
Numeral: 0 1 2 … 9
Letter: ABC…Z a b c…z
Character
Operator: + - = > < …
Others: \r \n \t …

Expression
branch: if-else; switch
Statement Control loop: for; while
Jump: break; goto…

Compound

Function: main( ), print(…) 7


1 The First Program Is Always The Same
lPrint the words: "\Hello, world"
you have to:
ØCreate the program text
ØCompile it successfully
ØRun it
ØGet the output

8
1 “Hello, world.” Program
/* File: hello.c
This program prints
program comment
the message “Hello,
world.” on the screen.
*/
library inclusions
#include <stdio.h>

void main ()
{ main function
printf (“Hello, world.\n”);
}
• The program is stored as a text file named hello.c
• .c identifies the file as a C program.
9
1 Compile it

10
1 Run it

11
1 Run it

12
The C Chapter
Programming
1. A Tutorial
LanguageIntroduction
Chapter
1.1 Getting
1. A Tutorial
Started
Introduction

1.1 Getting Started


Write a program in C to print the words:
hello, world !
include information
#include <stdio.h> about standard library
int main( ) main function with no arguments
{ statements of main are enclosed in brace
call library function
printf (“hello, world!”); named printf
“\n” is the notation for
} newline character.

13
The C Chapter
Programming
1. A Tutorial
LanguageIntroduction
Chapter
1.1 Getting
1. A Tutorial
Started
Introduction

1.1 Getting Started


Write a program in C to print the words:
hello, world

#include <stdio.h>
main( )
{
printf (“hello,”);
printf (“world”);
printf(“\n”);
}

14

You might also like