SlideShare a Scribd company logo
M VENKATESH
11604011
introduction
 C is general purpose languagewhich is very closely
associated with unix for which it was developed in bell
laboratories.
 Most of the programs UNIX are written and run with
help of c
 Many of ideas from of c stem are from BCPL, BY
Martin Richards
 In 1972 Dennis ritchie at bell laboratories wrote c
language which caused a revoultion in computing
world
About c
 C is a programmin language which can used to develop
the softwares or applications
 C can be defined as Mother language because different
programmin languages c++,python,.net.
 C can be defined as structure oriented programming
language
 C program instructions will executed line-by-line one
after the another and we need to write few statements
in specified place only
 C can be defined as procedure oriented programmin
language.
Translator
 Are the softwares which can translate the program
instruction s from one format to another
 Types of translatores :-
 1 compiler :H.L.L -> M.L(At a time all scan)
 2 Assembler :A.L ->M.l
 3 Interpreter : H.L.L->M.L(at one time line by
• line scanning)
• H.L.L means high level language
• M.L - middle level
• A.L - Assemble language
 High level language :- I is nothing but general english
language
 Middle level language:H.L.L+Assemble language
SOFTWARE
 Software:- a software is a programor a set of programs
system software:- are the software specially designed from
system
 ex: drivers-audio
 -printers
 Application software:- software are designeed from users
 Desktop application – which installation to use .
 als known as stand alone applications
 Web application – are the application runs on the server
 this is shareable
 ex :- gmail.com
History of c
 BASIC-beginners all purpose symbolic insruction code
 Cobol-commom business oriented language
 Fortran-formula transaltion
 Pascal
 Algol- algorthamic language
 Cpl-combined programming laguage
 BCPL – basic combined programming laguage
 Traditional c
 Ansic(american national standard instution)

 C95
 c99
features
 1 middle level language –h.l.l +a.l
 c programs can be written using H.L.L as well as
Assemble language
 so c is called middle level language
 Writing c programs much easier than assemble Language
 2 pre-defined language c:- c language offers pre-defined
function
 3 Modularity a program can divieded into su programs to
perform different operations.here such program called
“function”
 4 Extensibilty c programs can extend usily
 5 Memory Management:- in c language we can
allocated the memory dynamically as our requrement
so that use of memory efficient and no wastage of
memory
 6.Fast and efficient
 7.portable
C programs built from
 Variable and type declarations
 Functions
 Statements
 Expressions
a sample c program
 #include<stdio.h>
 Int man{
 Other statements
 }
Header files
 The files specified include section is called as header
file.
 These are precompiled files has some functions
defined in them
 Source file is extension .c
 Header file is extension .h
Main function
 This is entry point of program
 When file is executed the start point is main function
 From the main function the flow goes as programmers
choice
 Main function is compoulsory of any c program
Tokens type in c
 Constants:-
 Integer Constants – Refers to sequence of digits such as
decimal integer, octal integer and hexadecimal integer. –
Some of the examples are 112, 0551, 56579u, 0X2 etc.
• Real Constants – The floating point constants such as
0.0083, -0.78, +67.89 etc.
• Single Character Constants – A single char const contains a
single character enclosed within pair of single quotes [ ‘ ’ ].
For example, ‘8’, ‘a’ , ‘i’ etc.
• String Constants – A string constant is a sequence of
characters enclosed in double quotes [ “ ” ]; For example,
“0211”, “Stack Overflow” etc
Data types
 All Variables use data-type during declaration to
restrict the type of data to be stored. We can say that
data types are used to tell the variables the type of data
it can store.
 Primitive Data Types: Predefined Data Types and can
be used directly by the user to declare variables.
 Example:- int, char, float, etc.
 User defined data types:- These data types are defined
by user itself.
 Example :- Defining a Strucute in C or a union.
variables
 Variables is a name of a memory location which holds
any data
 When you create a variable in C, you must give it a data
type. You can assign a value to the variable at the time
you create it or later in your program code. This is
known as initializing the variable.
 Example:- int myVar = 0;
 Rules :-
 No space
 36-40 no lengthy characters
operators
 Operators are the foundation of any programming
language. We can define operators as symbols that helps us
to perform specific mathematical and logical computations
on operands. Types:-
 Arithmetic operators:- used to perform mathematical
operation.(+,-,*,/,%,++,--).
 Relational operators:- used for comparison of the values of
two operands.(==,>,=,<=).
 Logical operators:- used to combine two or more
conditions.(True or false)
 Bitwise operators:- used to perform bit-level operations on
the operands. And many more
statements
Output statement:-
*printf is a pre-defined function it can used to prints
message,values or result of the program
Syntax
printf(“ this is c programming”)
Input statement:-
Scanf():-
It is pre-defined function it can be used to read the values to
variables from keyoard at runtime of program
Syntax:- scanf(“format specifier list”,variable list with address
operator
If statement
 The if statements are concerned with Boolean logic. If
the statement is true, the block of code associated with
the if statement is executed. If the statement is false ,
control either falls through to the line after the if
statement, or after the closing curly brace of an if
statement block.
 Eg:- char response = ‘y’;
 if (response == ‘y’ || response == ‘Y’)
 { cout << “positive response received” << endl ;}
Switch staements
 If there are too many else if statements, code can
become messy and difficult to follow.in this scenario, a
better solution is to use a switch statement . The
switch statement simply replaces multiple else if
statements.
 Eg:- char response = ‘y’ ;
 Switch (response) { case ‘y’ : break ;
 Case ‘n’ : break ;
 Default : brea
Loops :-
 A loop is a reptative process.
 Types :-
 1.while
 Syntax:-while(condition)
 {
 satatements
 }
 2.Do-while
 syntax:- do{statements;
 }while(condition);
 3.For loop- for(intilization,condtion,inc/dec)
 Advantage:
 1.reduce length of file
 2.save time
Arrays in c
 Array is a collection of data items all of same types
 Three types of array
 1.one dimensional array
 2. two dimensional array
 3. multi dimensional array
 Array declaration syntax: data type arr_name[array_size];
 Learnt how to declare and initialize at compile time and run time
STRING IN C
 A string in C is merely an array of characters
 The length of a string is determined by a terminating null character:
'0‘
 String has some in built functions so it can save our time space and
efficient
Functions
 A Function is a block of statementswhich can useed to
perform any operation
 Pre-defined
 User defined
 Function terminology:-
 function prototype
 Function calling
 Function definition
 Parametres
 Return type
Function types
 1.no arg-no return
 2.no arg-return
 3.arg-no retun
 4.arg-retun
 Advantage
 1.extensinbility
 2.Resusebility
 3.modularity
Strucure and union
 Strucure:- collection of hetrogenous elements
 each member have memory location
 Struct is keyword
 individual members are accesed at a time
 Several members are initialised at once
 Union:
 Memory allocated individual member
 Union is keyword
 only first members are intilised
 Only one meber is accesd
pointers
 pointres:- it holds address of another varibel
 1 & address of pointer
 2. (*) value at addres pointer
 Types
 1,wild poiunter;- a pointer is not intilaised
 2dangling:-which pointer arise an object is deleted or deallocated
without modifying value of pointer.
 3.Null pointer:- initialize a pointer variable when that pointer
variable isn’t assigned any valid memory address A
 4.void pointer is a pointer that has no associated data type with
it. A void pointer can hold address of any type and can be
typcasted to a
 any type. Advantage :- malloc() calloc() is allocated at any type
DYNAMIC MEMORY ALLOCATION
 It is aprocess of allocating memory during execution time (or)
run time.
 Header file:- alloc.h or stdlib.h
 There are four types In this
 1.malloc
 2.calloc
 3.realloc
 4.free
 By malloc and calloc we can increase our memory dynamically
 By using realloc we can reallocate the memory if we want
 After the programme has completed we can free our memory by
using free statement
File handling
 It is a place on the disk we are a group of data stored
permananentlry
 Types
 Text file :-
 It is humanread file
 It is modifed
 Extension is doc
 Binary file :-
 It is not human readable file
 Extension is fof,efof
Types of file
 Sequentaial
 Random access
 File operations :-
 Read
 Opening a file
 Creating a file
 Writing a file
 Modifing a file
venkatesh.pptx

More Related Content

Similar to venkatesh.pptx

Aniket tore
Aniket toreAniket tore
Aniket tore
anikettore1
 
history of c.ppt
history of c.ppthistory of c.ppt
history of c.ppt
arpanabharani
 
The smartpath information systems c pro
The smartpath information systems c proThe smartpath information systems c pro
The smartpath information systems c pro
The Smartpath Information Systems,Bhilai,Durg,Chhattisgarh.
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
Rowank2
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
20EUEE018DEEPAKM
 
C material
C materialC material
C material
tarique472
 
Unit 2 introduction to c programming
Unit 2   introduction to c programmingUnit 2   introduction to c programming
Unit 2 introduction to c programming
Mithun DSouza
 
C language
C languageC language
C language
SMS2007
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
Durga Padma
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
Vikram Nandini
 
Presentation c++
Presentation c++Presentation c++
Presentation c++
JosephAlex21
 
Basic Information About C language PDF
Basic Information About C language PDFBasic Information About C language PDF
Basic Information About C language PDF
Suraj Das
 
1. introduction to computer
1. introduction to computer1. introduction to computer
1. introduction to computer
Shankar Gangaju
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
Ajeet Kumar
 
C notes
C notesC notes
C notes
Raunak Sodhi
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
ManiMala75
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
ManiMala75
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
amol_chavan
 
c#.pptx
c#.pptxc#.pptx
Chapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptChapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this ppt
ANISHYAPIT
 

Similar to venkatesh.pptx (20)

Aniket tore
Aniket toreAniket tore
Aniket tore
 
history of c.ppt
history of c.ppthistory of c.ppt
history of c.ppt
 
The smartpath information systems c pro
The smartpath information systems c proThe smartpath information systems c pro
The smartpath information systems c pro
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
 
C material
C materialC material
C material
 
Unit 2 introduction to c programming
Unit 2   introduction to c programmingUnit 2   introduction to c programming
Unit 2 introduction to c programming
 
C language
C languageC language
C language
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
Presentation c++
Presentation c++Presentation c++
Presentation c++
 
Basic Information About C language PDF
Basic Information About C language PDFBasic Information About C language PDF
Basic Information About C language PDF
 
1. introduction to computer
1. introduction to computer1. introduction to computer
1. introduction to computer
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
 
C notes
C notesC notes
C notes
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
 
c#.pptx
c#.pptxc#.pptx
c#.pptx
 
Chapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptChapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this ppt
 

Recently uploaded

Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
Ratnakar Mikkili
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
PuktoonEngr
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 

Recently uploaded (20)

Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 

venkatesh.pptx

  • 2. introduction  C is general purpose languagewhich is very closely associated with unix for which it was developed in bell laboratories.  Most of the programs UNIX are written and run with help of c  Many of ideas from of c stem are from BCPL, BY Martin Richards  In 1972 Dennis ritchie at bell laboratories wrote c language which caused a revoultion in computing world
  • 3. About c  C is a programmin language which can used to develop the softwares or applications  C can be defined as Mother language because different programmin languages c++,python,.net.  C can be defined as structure oriented programming language  C program instructions will executed line-by-line one after the another and we need to write few statements in specified place only  C can be defined as procedure oriented programmin language.
  • 4. Translator  Are the softwares which can translate the program instruction s from one format to another  Types of translatores :-  1 compiler :H.L.L -> M.L(At a time all scan)  2 Assembler :A.L ->M.l  3 Interpreter : H.L.L->M.L(at one time line by • line scanning) • H.L.L means high level language • M.L - middle level • A.L - Assemble language
  • 5.  High level language :- I is nothing but general english language  Middle level language:H.L.L+Assemble language
  • 6. SOFTWARE  Software:- a software is a programor a set of programs system software:- are the software specially designed from system  ex: drivers-audio  -printers  Application software:- software are designeed from users  Desktop application – which installation to use .  als known as stand alone applications  Web application – are the application runs on the server  this is shareable  ex :- gmail.com
  • 7. History of c  BASIC-beginners all purpose symbolic insruction code  Cobol-commom business oriented language  Fortran-formula transaltion  Pascal  Algol- algorthamic language  Cpl-combined programming laguage  BCPL – basic combined programming laguage  Traditional c  Ansic(american national standard instution)   C95  c99
  • 8. features  1 middle level language –h.l.l +a.l  c programs can be written using H.L.L as well as Assemble language  so c is called middle level language  Writing c programs much easier than assemble Language  2 pre-defined language c:- c language offers pre-defined function  3 Modularity a program can divieded into su programs to perform different operations.here such program called “function”
  • 9.  4 Extensibilty c programs can extend usily  5 Memory Management:- in c language we can allocated the memory dynamically as our requrement so that use of memory efficient and no wastage of memory  6.Fast and efficient  7.portable
  • 10. C programs built from  Variable and type declarations  Functions  Statements  Expressions
  • 11. a sample c program  #include<stdio.h>  Int man{  Other statements  }
  • 12. Header files  The files specified include section is called as header file.  These are precompiled files has some functions defined in them  Source file is extension .c  Header file is extension .h
  • 13. Main function  This is entry point of program  When file is executed the start point is main function  From the main function the flow goes as programmers choice  Main function is compoulsory of any c program
  • 14. Tokens type in c  Constants:-  Integer Constants – Refers to sequence of digits such as decimal integer, octal integer and hexadecimal integer. – Some of the examples are 112, 0551, 56579u, 0X2 etc. • Real Constants – The floating point constants such as 0.0083, -0.78, +67.89 etc. • Single Character Constants – A single char const contains a single character enclosed within pair of single quotes [ ‘ ’ ]. For example, ‘8’, ‘a’ , ‘i’ etc. • String Constants – A string constant is a sequence of characters enclosed in double quotes [ “ ” ]; For example, “0211”, “Stack Overflow” etc
  • 15. Data types  All Variables use data-type during declaration to restrict the type of data to be stored. We can say that data types are used to tell the variables the type of data it can store.  Primitive Data Types: Predefined Data Types and can be used directly by the user to declare variables.  Example:- int, char, float, etc.  User defined data types:- These data types are defined by user itself.  Example :- Defining a Strucute in C or a union.
  • 16. variables  Variables is a name of a memory location which holds any data  When you create a variable in C, you must give it a data type. You can assign a value to the variable at the time you create it or later in your program code. This is known as initializing the variable.  Example:- int myVar = 0;  Rules :-  No space  36-40 no lengthy characters
  • 17. operators  Operators are the foundation of any programming language. We can define operators as symbols that helps us to perform specific mathematical and logical computations on operands. Types:-  Arithmetic operators:- used to perform mathematical operation.(+,-,*,/,%,++,--).  Relational operators:- used for comparison of the values of two operands.(==,>,=,<=).  Logical operators:- used to combine two or more conditions.(True or false)  Bitwise operators:- used to perform bit-level operations on the operands. And many more
  • 18. statements Output statement:- *printf is a pre-defined function it can used to prints message,values or result of the program Syntax printf(“ this is c programming”) Input statement:- Scanf():- It is pre-defined function it can be used to read the values to variables from keyoard at runtime of program Syntax:- scanf(“format specifier list”,variable list with address operator
  • 19. If statement  The if statements are concerned with Boolean logic. If the statement is true, the block of code associated with the if statement is executed. If the statement is false , control either falls through to the line after the if statement, or after the closing curly brace of an if statement block.  Eg:- char response = ‘y’;  if (response == ‘y’ || response == ‘Y’)  { cout << “positive response received” << endl ;}
  • 20. Switch staements  If there are too many else if statements, code can become messy and difficult to follow.in this scenario, a better solution is to use a switch statement . The switch statement simply replaces multiple else if statements.  Eg:- char response = ‘y’ ;  Switch (response) { case ‘y’ : break ;  Case ‘n’ : break ;  Default : brea
  • 21. Loops :-  A loop is a reptative process.  Types :-  1.while  Syntax:-while(condition)  {  satatements  }  2.Do-while  syntax:- do{statements;  }while(condition);  3.For loop- for(intilization,condtion,inc/dec)  Advantage:  1.reduce length of file  2.save time
  • 22. Arrays in c  Array is a collection of data items all of same types  Three types of array  1.one dimensional array  2. two dimensional array  3. multi dimensional array  Array declaration syntax: data type arr_name[array_size];  Learnt how to declare and initialize at compile time and run time STRING IN C  A string in C is merely an array of characters  The length of a string is determined by a terminating null character: '0‘  String has some in built functions so it can save our time space and efficient
  • 23. Functions  A Function is a block of statementswhich can useed to perform any operation  Pre-defined  User defined  Function terminology:-  function prototype  Function calling  Function definition  Parametres  Return type
  • 24. Function types  1.no arg-no return  2.no arg-return  3.arg-no retun  4.arg-retun  Advantage  1.extensinbility  2.Resusebility  3.modularity
  • 25. Strucure and union  Strucure:- collection of hetrogenous elements  each member have memory location  Struct is keyword  individual members are accesed at a time  Several members are initialised at once  Union:  Memory allocated individual member  Union is keyword  only first members are intilised  Only one meber is accesd
  • 26. pointers  pointres:- it holds address of another varibel  1 & address of pointer  2. (*) value at addres pointer  Types  1,wild poiunter;- a pointer is not intilaised  2dangling:-which pointer arise an object is deleted or deallocated without modifying value of pointer.  3.Null pointer:- initialize a pointer variable when that pointer variable isn’t assigned any valid memory address A  4.void pointer is a pointer that has no associated data type with it. A void pointer can hold address of any type and can be typcasted to a  any type. Advantage :- malloc() calloc() is allocated at any type
  • 27. DYNAMIC MEMORY ALLOCATION  It is aprocess of allocating memory during execution time (or) run time.  Header file:- alloc.h or stdlib.h  There are four types In this  1.malloc  2.calloc  3.realloc  4.free  By malloc and calloc we can increase our memory dynamically  By using realloc we can reallocate the memory if we want  After the programme has completed we can free our memory by using free statement
  • 28. File handling  It is a place on the disk we are a group of data stored permananentlry  Types  Text file :-  It is humanread file  It is modifed  Extension is doc  Binary file :-  It is not human readable file  Extension is fof,efof
  • 29. Types of file  Sequentaial  Random access  File operations :-  Read  Opening a file  Creating a file  Writing a file  Modifing a file