C Theory

ShyamKhant1 3,080 views 36 slides Dec 26, 2016
Slide 1
Slide 1 of 36
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36

About This Presentation

Theory on C language


Slide Content

C language

Consists of a set of predefined rules. These rules form the syntax of that language. Hence learning a programming language is nothing but learning of that language. Introduction of c language

Computer can understand only instructions written in binary code ( 0 and 1), They do not directly read or understand a any programming language. And so a programming language is converted into binary code by using a special program called compiler. A program which translates instructions written in a programming language into binary code is called a compiler. When we write a program in C Language, what we write is called Source Code. The compiler’s output is called executable code . compiler

C is a programming language developed at AT&T Bell laboratories around 1972. It was designed and written by Dennis M. Ritchie . C was standardized in 1989 by American National Standard Institute (ANSI) . So it came to be known as ANSI C. C is a structured language. It breaks up a program into small parts known as functions . history

Flow chart use to define flow of any program. symbolic representation of program. use different symbols. Basic programming techniques

Rectangle Parallelogram Diamond Lines oval Symbols

Use to define process in program Rectangle

Use to define input and output in program Parallelogram

Use to specify condition in program Diomand

To show flow of the program lines

Use to declare start and end of flow chart and connect flow chart with other flow chart pages also. connector

start end Input output output condition Process if true Process if false

start end Insert value of i Print value of I is less than five Print value of I is greater than five If( i <5) Declare variable I as integer

Documentation Symbolic Constant Definition File Include Section Global Variable Declaration Main() { Declaration Executable Statements } Function 1 Function 2 Function n…. Structure of c program starting Section Compulsory section for all C Programs User Defined Functions

Compile is one type of program to convert source code into machine level code, Compiler compile the code of block and return the error and warning list. Compiler

#include < stdio.h > #include < conio.h > void main() { printf (“My first program”); getch (); } My first program in c language

#include < stdio.h > #include < conio.h > # : is pre possessive directive. use to include header files before start the program. Explanation of program

Header file is collection of pre define functions. Extension of header file is must “ .h ”. Header files are located in “INCLUDE” folder of “TC ”. Header files

void main() { main() c compile founds main() to start execution of program. must declare main function in every program. Explanation cont…

{ braces use to define starting of coding block. Explanation cont…

printf (“My First program”); printf () : use to print any formatted string in output window of Turbo c. header file : stdio.h ( standard input output ) Explanation cont…

getch (); } getch () use to get 1 character from keyboard. } define end of coding block. Explanation cont…

Compile the source code with. Alt + F9 Run the program with. Crtl + F9 How to run ?????

C language is totally case sensitive language. All the statements of C language must terminate with semi colon ( ; ) Must Remember

My First program Output of first program

file type extension C- Source file .C application file .EXE object file .OBJ Back ground files

Comment lines ignore by c compiler // use for single line comment /* */ use for multiline comment Comments in c languages

Integer Float Double Character Basic data types

Signed integer range -32,768 to 32,767 occupy first bit as a sigh bit. ( + / - ) memory space ( 2 bytes ) Integer

Unsigned integer range 0 to 65,535 not occupy any bit as sign bit. memory space ( 2 bytes ) Note : to declare unsigned integer variable must use unsigned key word before integer. Integer cont…

Use to store values with fiction point. memory space ( 4 bytes) 32 bits Double 64 bits(8 bytes) Long double 80 bits(10 bytes) Float

Default unsigned character 8 bits ( 1 byte ) Range : 0 to 255 Signed character 8 bits ( 1 byte ) Range : -128 to 127 Character

int a = 10; printf (“Value of variable a is : % d”,a ); o/p : Value of variable a is : 10 Print formatted output

%d use for integer values %f use for float values %c use for character %s use for String %l use for double values %lf use for long double values Other format strings

Use scanf () function Syntax : scanf (“format character ”, &variable name); Get values from user.

int a; printf (“Enter value of a ”); scanf (“% d”,&a ); printf (“Value of variable a is : % d”,a ); o/p value of variable a is : 10 Note : assume that we entered 10 from keyboard. example
Tags