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

Itprog 1

C programming language was developed in 1972 by Dennis Ritchie at Bell Labs. It was created based on an earlier language called B. Some key uses of C language include developing operating systems, compilers, interpreters, editors, and more. It has become one of the most widely used programming languages due to its flexibility and low-level access to memory.

Uploaded by

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

Itprog 1

C programming language was developed in 1972 by Dennis Ritchie at Bell Labs. It was created based on an earlier language called B. Some key uses of C language include developing operating systems, compilers, interpreters, editors, and more. It has become one of the most widely used programming languages due to its flexibility and low-level access to memory.

Uploaded by

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

C LANGUAGE

BRIEF HISTORY OF C
1. ALGOL (Algorithm Language) 1960 –
great influenced many other languages
and was the standard method for
algorithm.
2. CPL (Combined Programming
Language) 1963 – Multi paradigm
programming language.
3
3. BCPL (Basic Combined Programming
Language) 1967 – developed by Martin
Richards, this language turns strongly
influenced to the development of the next
language.
4. B (1970) – written and developed by Ken
Thompson at the Bell Lab. for the first unit
system.

4
5. C (1972) – expansion of B.
- a programming language designed by
Dennis Ritchie at Bell Telephone Lab.
6. Turbo C (1987) – A particular version is
designed to run on various micro
computers system namely those that MS
DOS (Microsoft Disk Operating System)
uses of C.
5
USES OF C

1. OPERATING SYSTEM
2. INTERPRETERS
3. EDITORS
4. ASSEMBLERS
5. COMPILERS
6. DATABASE MANAGER
7. NETWORK DEVICES
6
DEFINITION OF TERMS

a. Interpreters – reads the source code of


your computer one time and perform the
specific instruction contained in that line.
b. Compilers – reads the entire program and
converts into a form that can be directly
executed by the computer.
c. Compile time – refers to the events that
occur during the compilation process.
7
DEFINITION OF TERMS
d. Source code – the text of a program that a
user can commonly thought of as a program.
e. Library – collection of pre-written
f. Run time – refers to the events that occur while
the is actually executing.
- errors detected during execution time.
g. Syntax – Grammatical mistakes in your
program.
8
COMPONENTS OF TURBO C
1. Editor – used to create/edit a program
source code.
2. Compilers – used to convert source code
into binary code.
3. Debugger – used for testing program and
locating programming errors.

9
C PROGRAMMING STRUCTURES
<#include directive>
<#define directive>
<variable declaration section>
main()
{ */Beginning of a program*/
Body/Statements;
getch();
}*/Ending of a program*/
10
EXAMPLE:
<#include stdio.h> OUTPUT: Hello World
main()
{
clrscr();
print f(“Hello World”);
getch();
}
11
a. #include directive – consist information
needed by the program to ensure the correct
operation of turbo C is the standard library
function.
b. #define directive – use the shorten the
keywords in program.
c. Variable declaration section – it is the
place where you declare your variable.
12
d. Body of a program – start by typing
main() and the { and } (open and close)
brace – all statements should be written
side and parenthesis.
Note: Turbo C is a case sensitive program
therefore use lower case letter only.

13
COMMONLY USED INCLUDE FILES IN C
LANGUAGE
1. alloc.h - non-standard header
2. conio.h – console input output.header
3. stdio.h – standard input out. Header
4. string.h – String header

14
IMPORTANT SYMBOLS IN TURBO C
a. \n – a line character used to move the
cursor to the next line.
b. ‘ ‘– single quote is used for single
character letter.
c. “ “ – double quote is used for two or
more characters.
d. { - open curly bracket signifies begin.
15
IMPORTANT SYMBOLS IN TURBO C
e. } – close curly bracket signifies end.
f. & - address operation, ampersand.
INPUT/OUTPUT STATEMENTS
1. Input statement – a statement used to
input a single character or a sequence of
characters from a keyboard.
16
Scan f – it needs the control string codes in
able upon inputting.
2. Output Statement – a statement used
to display the argument list on the monitor.
It sometimes, needs the control string

17
LIST OF COMMONLY USED FORMAT SPECIFIERS
1. %c – used for single character in c
language. Ex: scanf(“%c”,&num);
printf(“%d”,num);
2. %d – used for integer number.
Ex: scanf(“%d”, &num);
printf(“%d”, num);
18
3. %e – used for specific notation
Ex: scanf(“%e”, &result);
printf(“%e”, result);
4. %If – used decimal number
Ex: scanf(“%If”, &one);
printf(“%If”, one);
5. %f – used for number with floating
Ex: scanf(“%f”, &pesos);
printf(“%f”, pesos);
19
6. %o – used for octal number
Ex: scanf(“%o”, &value);
printf(“%o”, value);
7. %s – used for string of character
Ex: scanf(“%s”, &str);
printf(“%s”, str);
8. %u – used for unsigned numbers.
Ex: scanf(“%u”, &nos);
printf(“%u”, nos);
20
9. %x – used for hexadecimal number
Ex: scanf(“%x”, &nos);
printf(“%x”, nos);
10. %% - used for percent sign
Ex: scanf(“%%”, &value);
printf(“%%”, value);

21
LIST OF COMMONLY USED ESCAPE SEQUENCE
a. \\ - print backslash
b. \’ – print single quote
c. \” – print double quote
d. \n – print next line
e. \? – print question mark
f. \b – print backspace
g. \f – print form speed
h. \t – horizontal tab
i. \v – vertical tab 22
Arithmetic
Symbol Example
Operations
◦Multiplication * A*B
◦Division / X/Y
◦Addition + int 1 + int 2
◦Subtraction C-O
-
◦Exponentiation C^2
^

25
RELATIONA
Symbol Example
L OPERATOR
◦Greater than > A>B
◦Less than < X<Y
◦Equal to == int 1 == int 2
◦Not Equal to net <> gross
<>
◦Greater than or Pay 1 >= Pay 2
>=
equal to
26

You might also like