SlideShare a Scribd company logo
1 of 17
INTRODUCTION TO C PROGRAMMING
• C language :
 Is system programming language.
 Is procedure-oriented programming language.
 Is also called mid level programming language.
 was developed in 1972 by Dennis Ritchie at bell laboratories of
AT&T(American Telephone & Telegraph), located in U.S.A.
 was developed to be used in UNIX Operating system.
FEATURES
• Simple
• Machine Independent or Portable
• Mid-level programming language
• structured programming language
• Rich Library
• Memory Management
• Fast Speed
• Pointers
• Recursion
• Extensible
FIRST PROGRAM OF LANGUAGE
PROGRAM :
#include <stdio.h>
#include <conio.h>
void main()
{
printf("Hello World");
getch();
}
OUTPUT :
Hello World
DESCRIBING THE PROGRAM
• #include <stdio.h> includes the standard input output library
functions. The printf() function is defined in stdio.h
• #include <conio.h> includes the console input output library
functions. The getch() function is defined in conio.h file
• void main()
The main() function is the entry point of every program in C
language. The void keyword specifies that it returns no value
• printf()
The printf() function is used to print data on the console
• getch()
The getch() function asks for a single character. Until you press any
key, it blocks the screen
INPUT OUTPUT FUNCTION
• There are two input output function of c language.
 printf() is used for output.
 It prints the given statement to the console.
 Syntax of printf() is given below:
printf(“format string”,arguments_list);
 Sample Format strings : %d(integer), %c(character), %s(string), %f(float) etc.
 scanf() is used for input.
 It reads the input data from console.
 Syntax of scanf() is given below:
 scanf(“format string”,argument_list);
DATA TYPES & KEYWORDS
• 4 types of data types
• A keyword is a reserved word. You cannot use it as a variable name,
constant name etc.
OPERATORS
• There are following types of operators to perform different
types of operations in C language.
 Arithmetic Operators
 Relational Operators
 Shift Operators
 Logical Operators
 Bitwise Operators
 Ternary or Conditional Operators
 Assignment Operator
 Misc Operator
CONTROL STATEMENTS
• if-else
 If statement
 If-else statement
 If else-if ladder
 Nested if
• switch
• loops
• do-while loop
• while loop
• for loop
• break
• continue
IF-ELSE IN C
SWITCH IN C
switch(expression) {
case constant-expression :
statement(s);
break; /* optional */
case constant-expression :
statement(s);
break; /* optional */
default : /* Optional */
statement(s);
}
LOOPS IN C
• Loops are used to execute a block of code or a part of program of
the program several times.
• Types of loops in C language:-
 do while
 It is better if you have to execute the code at least once
 while
 It is better if number of iteration is not known by the user.
 for
 It is good if number of iteration is known by the user.
CONTROL STATEMENTS continued…
• BREAK is used to break the execution of loop (while, do while and for) and
switch case.
• CONTINUE is used to continue the execution of loop (while, do while and
for). It is used with if condition within the loop.
FUNCTIONS IN C
• To perform any task, we can create function. A function can be
called many times. It provides modularity and code reusability.
• Advantage of function:-
 Code Reusability
 Code optimization
CALL BY VALUE
• In call by value, value being passed to the function is locally stored by the
function parameter in stack memory location. If you change the value of
function parameter, it is changed for the current function only. It will not
change the value of variable inside the caller method such as main().
• Output :
CALL BY REFERENCE
• In call by reference, original value is modified because we pass
reference (address).
• OUTPUT :
RECURSION IN C
• A function that calls itself, and doen't perform any task after
function call, is know as tail recursion. In tail recursion, we
generally call the same function with return statement.
ARRAY IN C
• Array in C language is a collection or group of elements (data). All
the elements of array are homogeneous(similar). It has
contiguous memory location.
• Declaration of array :
 data_type array_name[array_size];
• Types of array:-
 1-D Array
 2-D Array
• Advantage of array :
 Code Optimization
 Easy to traverse data
 Easy to sort data
 Random Access

More Related Content

What's hot (20)

Forloop
ForloopForloop
Forloop
 
Array in c
Array in cArray in c
Array in c
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
Function in C program
Function in C programFunction in C program
Function in C program
 
C functions
C functionsC functions
C functions
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
How to execute a C program
How to execute a C  program How to execute a C  program
How to execute a C program
 
Loops in c programming
Loops in c programmingLoops in c programming
Loops in c programming
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Operators in C++
Operators in C++Operators in C++
Operators in C++
 
Character set of c
Character set of cCharacter set of c
Character set of c
 
Loops in c
Loops in cLoops in c
Loops in c
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
Types of loops in c language
Types of loops in c languageTypes of loops in c language
Types of loops in c language
 
data types in C programming
data types in C programmingdata types in C programming
data types in C programming
 
Operators in c language
Operators in c languageOperators in c language
Operators in c language
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 

Viewers also liked

C LANGUAGE - BESTECH SOLUTIONS
C LANGUAGE - BESTECH SOLUTIONSC LANGUAGE - BESTECH SOLUTIONS
C LANGUAGE - BESTECH SOLUTIONSBESTECH SOLUTIONS
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGAbhishek Dwivedi
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_outputAnil Dutt
 
Overview of c language
Overview of c languageOverview of c language
Overview of c languageshalini392
 
Complete report on DATA ACQUISITION SCHEME IN WIRELESS SENSOR NETWORK
Complete report on DATA ACQUISITION SCHEME IN WIRELESS SENSOR NETWORKComplete report on DATA ACQUISITION SCHEME IN WIRELESS SENSOR NETWORK
Complete report on DATA ACQUISITION SCHEME IN WIRELESS SENSOR NETWORKRutvik Pensionwar
 
Unix Introduction
Unix IntroductionUnix Introduction
Unix IntroductionAnanthi
 
Introduction to c programming language
Introduction to c programming languageIntroduction to c programming language
Introduction to c programming languagesanjay joshi
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingManoj Tyagi
 
Introduction to programming with c,
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,Hossain Md Shakhawat
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programmingTarun Sharma
 
Steps for Developing a 'C' program
 Steps for Developing a 'C' program Steps for Developing a 'C' program
Steps for Developing a 'C' programSahithi Naraparaju
 
Programming in C Basics
Programming in C BasicsProgramming in C Basics
Programming in C BasicsBharat Kalia
 

Viewers also liked (20)

C LANGUAGE - BESTECH SOLUTIONS
C LANGUAGE - BESTECH SOLUTIONSC LANGUAGE - BESTECH SOLUTIONS
C LANGUAGE - BESTECH SOLUTIONS
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_output
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
C material
C materialC material
C material
 
Overview of c language
Overview of c languageOverview of c language
Overview of c language
 
C ppt
C pptC ppt
C ppt
 
C language ppt
C language pptC language ppt
C language ppt
 
Complete report on DATA ACQUISITION SCHEME IN WIRELESS SENSOR NETWORK
Complete report on DATA ACQUISITION SCHEME IN WIRELESS SENSOR NETWORKComplete report on DATA ACQUISITION SCHEME IN WIRELESS SENSOR NETWORK
Complete report on DATA ACQUISITION SCHEME IN WIRELESS SENSOR NETWORK
 
UNIX introduction
UNIX introductionUNIX introduction
UNIX introduction
 
Unix Introduction
Unix IntroductionUnix Introduction
Unix Introduction
 
Linking in MS-Dos System
Linking in MS-Dos SystemLinking in MS-Dos System
Linking in MS-Dos System
 
Introduction to c programming language
Introduction to c programming languageIntroduction to c programming language
Introduction to c programming language
 
Pointers+(2)
Pointers+(2)Pointers+(2)
Pointers+(2)
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Introduction to programming with c,
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programming
 
Structure in C
Structure in CStructure in C
Structure in C
 
Steps for Developing a 'C' program
 Steps for Developing a 'C' program Steps for Developing a 'C' program
Steps for Developing a 'C' program
 
Programming in C Basics
Programming in C BasicsProgramming in C Basics
Programming in C Basics
 

Similar to Introduction to C programming

424769021-1-First-C-Program-1-ppt (1).ppt
424769021-1-First-C-Program-1-ppt (1).ppt424769021-1-First-C-Program-1-ppt (1).ppt
424769021-1-First-C-Program-1-ppt (1).pptadvRajatSharma
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii pptJStalinAsstProfessor
 
Basics of C Prog Lang.pdf
Basics of C Prog Lang.pdfBasics of C Prog Lang.pdf
Basics of C Prog Lang.pdfKalighatOkira
 
c-introduction.pptx
c-introduction.pptxc-introduction.pptx
c-introduction.pptxMangala R
 
C programmimng basic.ppt
C programmimng basic.pptC programmimng basic.ppt
C programmimng basic.pptASIT Education
 
cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8kapil078
 
Unit-1 (introduction to c language).pptx
Unit-1 (introduction to c language).pptxUnit-1 (introduction to c language).pptx
Unit-1 (introduction to c language).pptxsaivasu4
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.pptManiMala75
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.pptManiMala75
 
Introduction to c
Introduction to cIntroduction to c
Introduction to cAjeet Kumar
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Rasan Samarasinghe
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1YOGESH SINGH
 

Similar to Introduction to C programming (20)

C language
C languageC language
C language
 
C language updated
C language updatedC language updated
C language updated
 
424769021-1-First-C-Program-1-ppt (1).ppt
424769021-1-First-C-Program-1-ppt (1).ppt424769021-1-First-C-Program-1-ppt (1).ppt
424769021-1-First-C-Program-1-ppt (1).ppt
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
 
Basics of C Prog Lang.pdf
Basics of C Prog Lang.pdfBasics of C Prog Lang.pdf
Basics of C Prog Lang.pdf
 
Functions
FunctionsFunctions
Functions
 
C programming
C programmingC programming
C programming
 
c-introduction.pptx
c-introduction.pptxc-introduction.pptx
c-introduction.pptx
 
C programmimng basic.ppt
C programmimng basic.pptC programmimng basic.ppt
C programmimng basic.ppt
 
C
CC
C
 
Presentation c++
Presentation c++Presentation c++
Presentation c++
 
cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8
 
Unit-1 (introduction to c language).pptx
Unit-1 (introduction to c language).pptxUnit-1 (introduction to c language).pptx
Unit-1 (introduction to c language).pptx
 
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
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
C for Engineers
C for EngineersC for Engineers
C for Engineers
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 

More from Rutvik Pensionwar

Optimized cluster index generation
Optimized cluster index generationOptimized cluster index generation
Optimized cluster index generationRutvik Pensionwar
 
Kayak Prototype using MERN Stack
Kayak Prototype using MERN StackKayak Prototype using MERN Stack
Kayak Prototype using MERN StackRutvik Pensionwar
 
Team pioneers presents halloween night
Team pioneers presents halloween nightTeam pioneers presents halloween night
Team pioneers presents halloween nightRutvik Pensionwar
 
Quality Metrics In Ubiquitous Computing
Quality Metrics In Ubiquitous ComputingQuality Metrics In Ubiquitous Computing
Quality Metrics In Ubiquitous ComputingRutvik Pensionwar
 
Achieving Efficient Data Acquisition Techniques in Wireless Sensor Networks
Achieving Efficient Data Acquisition Techniques in Wireless Sensor NetworksAchieving Efficient Data Acquisition Techniques in Wireless Sensor Networks
Achieving Efficient Data Acquisition Techniques in Wireless Sensor NetworksRutvik Pensionwar
 
Data acquisition and storage in Wireless Sensor Network
Data acquisition and storage in Wireless Sensor NetworkData acquisition and storage in Wireless Sensor Network
Data acquisition and storage in Wireless Sensor NetworkRutvik Pensionwar
 

More from Rutvik Pensionwar (9)

Optimized cluster index generation
Optimized cluster index generationOptimized cluster index generation
Optimized cluster index generation
 
Kayak Prototype using MERN Stack
Kayak Prototype using MERN StackKayak Prototype using MERN Stack
Kayak Prototype using MERN Stack
 
Team pioneers presents halloween night
Team pioneers presents halloween nightTeam pioneers presents halloween night
Team pioneers presents halloween night
 
Wireless sensor network
Wireless sensor networkWireless sensor network
Wireless sensor network
 
Quality Metrics In Ubiquitous Computing
Quality Metrics In Ubiquitous ComputingQuality Metrics In Ubiquitous Computing
Quality Metrics In Ubiquitous Computing
 
Achieving Efficient Data Acquisition Techniques in Wireless Sensor Networks
Achieving Efficient Data Acquisition Techniques in Wireless Sensor NetworksAchieving Efficient Data Acquisition Techniques in Wireless Sensor Networks
Achieving Efficient Data Acquisition Techniques in Wireless Sensor Networks
 
Data acquisition and storage in Wireless Sensor Network
Data acquisition and storage in Wireless Sensor NetworkData acquisition and storage in Wireless Sensor Network
Data acquisition and storage in Wireless Sensor Network
 
WIRELESS SENSOR NETWORK
WIRELESS SENSOR NETWORKWIRELESS SENSOR NETWORK
WIRELESS SENSOR NETWORK
 
UBIQUITOUS COMPUTING
UBIQUITOUS COMPUTINGUBIQUITOUS COMPUTING
UBIQUITOUS COMPUTING
 

Recently uploaded

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 

Introduction to C programming

  • 1. INTRODUCTION TO C PROGRAMMING • C language :  Is system programming language.  Is procedure-oriented programming language.  Is also called mid level programming language.  was developed in 1972 by Dennis Ritchie at bell laboratories of AT&T(American Telephone & Telegraph), located in U.S.A.  was developed to be used in UNIX Operating system.
  • 2. FEATURES • Simple • Machine Independent or Portable • Mid-level programming language • structured programming language • Rich Library • Memory Management • Fast Speed • Pointers • Recursion • Extensible
  • 3. FIRST PROGRAM OF LANGUAGE PROGRAM : #include <stdio.h> #include <conio.h> void main() { printf("Hello World"); getch(); } OUTPUT : Hello World
  • 4. DESCRIBING THE PROGRAM • #include <stdio.h> includes the standard input output library functions. The printf() function is defined in stdio.h • #include <conio.h> includes the console input output library functions. The getch() function is defined in conio.h file • void main() The main() function is the entry point of every program in C language. The void keyword specifies that it returns no value • printf() The printf() function is used to print data on the console • getch() The getch() function asks for a single character. Until you press any key, it blocks the screen
  • 5. INPUT OUTPUT FUNCTION • There are two input output function of c language.  printf() is used for output.  It prints the given statement to the console.  Syntax of printf() is given below: printf(“format string”,arguments_list);  Sample Format strings : %d(integer), %c(character), %s(string), %f(float) etc.  scanf() is used for input.  It reads the input data from console.  Syntax of scanf() is given below:  scanf(“format string”,argument_list);
  • 6. DATA TYPES & KEYWORDS • 4 types of data types • A keyword is a reserved word. You cannot use it as a variable name, constant name etc.
  • 7. OPERATORS • There are following types of operators to perform different types of operations in C language.  Arithmetic Operators  Relational Operators  Shift Operators  Logical Operators  Bitwise Operators  Ternary or Conditional Operators  Assignment Operator  Misc Operator
  • 8. CONTROL STATEMENTS • if-else  If statement  If-else statement  If else-if ladder  Nested if • switch • loops • do-while loop • while loop • for loop • break • continue
  • 10. SWITCH IN C switch(expression) { case constant-expression : statement(s); break; /* optional */ case constant-expression : statement(s); break; /* optional */ default : /* Optional */ statement(s); }
  • 11. LOOPS IN C • Loops are used to execute a block of code or a part of program of the program several times. • Types of loops in C language:-  do while  It is better if you have to execute the code at least once  while  It is better if number of iteration is not known by the user.  for  It is good if number of iteration is known by the user.
  • 12. CONTROL STATEMENTS continued… • BREAK is used to break the execution of loop (while, do while and for) and switch case. • CONTINUE is used to continue the execution of loop (while, do while and for). It is used with if condition within the loop.
  • 13. FUNCTIONS IN C • To perform any task, we can create function. A function can be called many times. It provides modularity and code reusability. • Advantage of function:-  Code Reusability  Code optimization
  • 14. CALL BY VALUE • In call by value, value being passed to the function is locally stored by the function parameter in stack memory location. If you change the value of function parameter, it is changed for the current function only. It will not change the value of variable inside the caller method such as main(). • Output :
  • 15. CALL BY REFERENCE • In call by reference, original value is modified because we pass reference (address). • OUTPUT :
  • 16. RECURSION IN C • A function that calls itself, and doen't perform any task after function call, is know as tail recursion. In tail recursion, we generally call the same function with return statement.
  • 17. ARRAY IN C • Array in C language is a collection or group of elements (data). All the elements of array are homogeneous(similar). It has contiguous memory location. • Declaration of array :  data_type array_name[array_size]; • Types of array:-  1-D Array  2-D Array • Advantage of array :  Code Optimization  Easy to traverse data  Easy to sort data  Random Access