SlideShare una empresa de Scribd logo
1 de 20
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Basic of C


   Atheendrh Kakkoth
   atheendrh@gmail.com
   Atheendrh kakkoth
Execution of C Program


•Creating a program :
An editor like notepad or word pad is used to create a C program. This file contains a
source code which consists of executable code. save as .c
• Compiling the program :
The next step is to compile the program. The code is compiled by using compiler. Compiler
converts executable code to binary code
•Linking a program to library :
The object code of a program is linked with libraries that are needed for execution of a
program. The linker is used to link the program with libraries.

•Execution of program :
The final executable file is then run by dos command prompt or by any other software.
Tokens
Tokens are individual words marks in passage of text. In C, program
the smallest individual units are known as C Tokens. C has Six
types of Tokens. The Tokens are shown in figure
Tokens
• Keywords
   – These are reserved words of the C language. For
     example int, float, if, else, for,
     while etc.
• Identifiers
   – An Identifier is a sequence of letters and digits, but
     must start with a letter. Underscore ( _ ) is treated as a
     letter. Identifiers are used to name variables, functions
     etc.
   – Valid: Root, _getchar, __sin, x1, x2,
     x3, x_1, If
   – Invalid: 324, short, price$, My Name
Tokens
• Constants
  – Constants like 13, ‘a’, 1.3e-5 etc.
• Strings
  – A sequence of characters enclosed in double
    quotes as “…”. For example “13” is a string literal
    and not number 13. ‘a’ and “a” are different.
• Operators
  – Arithmetic operators like +, -, *, / ,% etc.
  – Logical operators like ||, &&, ! etc. and so on
Tokens
• special symbol: ~ ! @ # $ % ^ & * ( ) _ + { } [ ]
  -<>,./?|:;"'


• White Spaces
  – Spaces, new lines, tabs, comments ( A sequence
    of characters enclosed in /* and */ ) etc. These are
    used to separate the adjacent identifiers, kewords
    and constants.
Header file                                    I
                                                               Identifiers
                           Key word



                                                    Strings

                                                        Special symbol


          Operators



Header file contains different predefined functions, which are required to run the
                                     program
Header File in C :
Header file contains different predefined
functions, which are required to run the
program. All header files should be included
explicitly before main ( ) function
Followings are the some commonly used header files which plays
a vital role in C programming :


        Assert.h          Ctype.h            Math.h

       Process.h          Stdio.h           Stdlib.h

        String.h           Time.h          Graphics.h
Stdio.h
stdio.h refers to standard input/output header file.
 The functions which are declared in stdio.h are very
 popular.
scanf() -used to take input from the standard input
 stream
Printf() -prints to the standard output stream
Data Types in C :
Decision Making Statements
  C program executes program sequentially.
  Sometimes, a program requires checking of
  certain conditions in program execution. These
  statements are called as 'Decision Making
  Statements' or 'Conditional Statements‘
• Followings are the different conditional
  statements used in C.
• If Statement
• If-Else Statement
If Statement :
This is a conditional statement used in C to
check condition or to control the flow of
execution of statements.

  Syntax:

if(condition)
      {
statements;
      }
If-Else Statement :
This is also one of the most useful conditional
  statement used in C to check conditions

       Syntax:
    if(condition)
           {
  true statements;
           }
         else
           {
  false statements;
           }
Looping Statements
  A loop is used using condition. The repetition is
  done until condition is true
• Some common examples of this looping
  statements are :
• while loop
• for loop
While loop
It is used to repeat a block of statements until
   condition is true.


 Syntax:
 while(condition)
  {
 statements;
  increment/decrement;
  }
For loop
One of the most important feature of this loop is
 that the three actions can be taken at a time like
 variable initilisation, condition checking
 and increment/decrement.                           #include <stdio.h>
                                                     #include <conio.h>
                                                    void main()
                      Syntax:                       {
                                                     int a;
 for(initialisation; test-condition; incre/decre)     for(i=0; i<=5; i++)
                                                     {
                          {                          printf("n");
                   statements;                      }

                          }
If this presentation helped you, please visit our
           page facebook.com/baabtra and like it.
               Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us

Más contenido relacionado

La actualidad más candente

Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILEDipta Saha
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01Wingston
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c languageRai University
 
C language for Semester Exams for Engineers
C language for Semester Exams for Engineers C language for Semester Exams for Engineers
C language for Semester Exams for Engineers Appili Vamsi Krishna
 
Shell scripting - Basic (PART -1)
Shell scripting - Basic (PART -1)Shell scripting - Basic (PART -1)
Shell scripting - Basic (PART -1)Chitrakshi Jaiswal
 
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requirePHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requireTheCreativedev Blog
 
Tutorial on c language programming
Tutorial on c language programmingTutorial on c language programming
Tutorial on c language programmingSudheer Kiran
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in CHarendra Singh
 
Learn C# Programming - Operators
Learn C# Programming - OperatorsLearn C# Programming - Operators
Learn C# Programming - OperatorsEng Teong Cheah
 
What is keyword in c programming
What is keyword in c programmingWhat is keyword in c programming
What is keyword in c programmingRumman Ansari
 
Schema, validation and generative testing
Schema, validation and generative testingSchema, validation and generative testing
Schema, validation and generative testingLaurence Chen
 

La actualidad más candente (20)

Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
C language ppt
C language pptC language ppt
C language ppt
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
Unit 7. Functions
Unit 7. FunctionsUnit 7. Functions
Unit 7. Functions
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Learning the C Language
Learning the C LanguageLearning the C Language
Learning the C Language
 
C language for Semester Exams for Engineers
C language for Semester Exams for Engineers C language for Semester Exams for Engineers
C language for Semester Exams for Engineers
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Shell scripting - Basic (PART -1)
Shell scripting - Basic (PART -1)Shell scripting - Basic (PART -1)
Shell scripting - Basic (PART -1)
 
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requirePHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and require
 
Tutorial on c language programming
Tutorial on c language programmingTutorial on c language programming
Tutorial on c language programming
 
Function C programming
Function C programmingFunction C programming
Function C programming
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
 
Cpu
CpuCpu
Cpu
 
Learn C# Programming - Operators
Learn C# Programming - OperatorsLearn C# Programming - Operators
Learn C# Programming - Operators
 
C Token’s
C Token’sC Token’s
C Token’s
 
What is keyword in c programming
What is keyword in c programmingWhat is keyword in c programming
What is keyword in c programming
 
Schema, validation and generative testing
Schema, validation and generative testingSchema, validation and generative testing
Schema, validation and generative testing
 

Destacado

Destacado (19)

Java exeception handling
Java exeception handlingJava exeception handling
Java exeception handling
 
XML
XMLXML
XML
 
XML
XMLXML
XML
 
Flowchart& algorithom
Flowchart& algorithomFlowchart& algorithom
Flowchart& algorithom
 
XML
XMLXML
XML
 
Binary tree
Binary treeBinary tree
Binary tree
 
Stack and heap
Stack and heapStack and heap
Stack and heap
 
Mail in php codeigniter
Mail in php codeigniterMail in php codeigniter
Mail in php codeigniter
 
Html tags
Html tagsHtml tags
Html tags
 
MIS
MISMIS
MIS
 
What is Python?
What is Python?What is Python?
What is Python?
 
Travel agency
Travel agency Travel agency
Travel agency
 
Dependent selection box using codeigniter ajax
Dependent selection box using codeigniter ajaxDependent selection box using codeigniter ajax
Dependent selection box using codeigniter ajax
 
Claas diagram
Claas diagramClaas diagram
Claas diagram
 
Modules in Python
Modules in PythonModules in Python
Modules in Python
 
how to prepare for an interview
how to prepare for an interviewhow to prepare for an interview
how to prepare for an interview
 
Bill gates and his contributions to world
Bill gates and his contributions to worldBill gates and his contributions to world
Bill gates and his contributions to world
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
System software and Application software
System software and Application softwareSystem software and Application software
System software and Application software
 

Similar a Basics of C porgramming

C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)sachindane
 
C programming language tutorial
C programming language tutorialC programming language tutorial
C programming language tutorialSURBHI SAROHA
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingRasan Samarasinghe
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingAlpana Gupta
 
Basics of C Prog Lang.pdf
Basics of C Prog Lang.pdfBasics of C Prog Lang.pdf
Basics of C Prog Lang.pdfKalighatOkira
 
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
 
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
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubeykiranrajat
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing TutorialMahira Banu
 

Similar a Basics of C porgramming (20)

c programming session 1.pptx
c programming session 1.pptxc programming session 1.pptx
c programming session 1.pptx
 
C programming
C programmingC programming
C programming
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
 
Introduction to C
Introduction to CIntroduction to C
Introduction to C
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
Basics of C porgramming
Basics of C porgrammingBasics of C porgramming
Basics of C porgramming
 
C programming language tutorial
C programming language tutorialC programming language tutorial
C programming language tutorial
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
C language updated
C language updatedC language updated
C language updated
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
C language
C languageC language
C language
 
Basics of C Prog Lang.pdf
Basics of C Prog Lang.pdfBasics of C Prog Lang.pdf
Basics of C Prog Lang.pdf
 
history of c.ppt
history of c.ppthistory of c.ppt
history of c.ppt
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++
 
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
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
 
C intro
C introC intro
C intro
 
Presentation c++
Presentation c++Presentation c++
Presentation c++
 

Más de baabtra.com - No. 1 supplier of quality freshers

Más de baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Último

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 

Último (20)

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 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
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 

Basics of C porgramming

  • 1.
  • 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3. Basic of C Atheendrh Kakkoth atheendrh@gmail.com Atheendrh kakkoth
  • 4. Execution of C Program •Creating a program : An editor like notepad or word pad is used to create a C program. This file contains a source code which consists of executable code. save as .c • Compiling the program : The next step is to compile the program. The code is compiled by using compiler. Compiler converts executable code to binary code •Linking a program to library : The object code of a program is linked with libraries that are needed for execution of a program. The linker is used to link the program with libraries. •Execution of program : The final executable file is then run by dos command prompt or by any other software.
  • 5. Tokens Tokens are individual words marks in passage of text. In C, program the smallest individual units are known as C Tokens. C has Six types of Tokens. The Tokens are shown in figure
  • 6. Tokens • Keywords – These are reserved words of the C language. For example int, float, if, else, for, while etc. • Identifiers – An Identifier is a sequence of letters and digits, but must start with a letter. Underscore ( _ ) is treated as a letter. Identifiers are used to name variables, functions etc. – Valid: Root, _getchar, __sin, x1, x2, x3, x_1, If – Invalid: 324, short, price$, My Name
  • 7. Tokens • Constants – Constants like 13, ‘a’, 1.3e-5 etc. • Strings – A sequence of characters enclosed in double quotes as “…”. For example “13” is a string literal and not number 13. ‘a’ and “a” are different. • Operators – Arithmetic operators like +, -, *, / ,% etc. – Logical operators like ||, &&, ! etc. and so on
  • 8. Tokens • special symbol: ~ ! @ # $ % ^ & * ( ) _ + { } [ ] -<>,./?|:;"' • White Spaces – Spaces, new lines, tabs, comments ( A sequence of characters enclosed in /* and */ ) etc. These are used to separate the adjacent identifiers, kewords and constants.
  • 9. Header file I Identifiers Key word Strings Special symbol Operators Header file contains different predefined functions, which are required to run the program
  • 10. Header File in C : Header file contains different predefined functions, which are required to run the program. All header files should be included explicitly before main ( ) function Followings are the some commonly used header files which plays a vital role in C programming : Assert.h Ctype.h Math.h Process.h Stdio.h Stdlib.h String.h Time.h Graphics.h
  • 11. Stdio.h stdio.h refers to standard input/output header file. The functions which are declared in stdio.h are very popular. scanf() -used to take input from the standard input stream Printf() -prints to the standard output stream
  • 13. Decision Making Statements C program executes program sequentially. Sometimes, a program requires checking of certain conditions in program execution. These statements are called as 'Decision Making Statements' or 'Conditional Statements‘ • Followings are the different conditional statements used in C. • If Statement • If-Else Statement
  • 14. If Statement : This is a conditional statement used in C to check condition or to control the flow of execution of statements. Syntax: if(condition) { statements; }
  • 15. If-Else Statement : This is also one of the most useful conditional statement used in C to check conditions Syntax: if(condition) { true statements; } else { false statements; }
  • 16. Looping Statements A loop is used using condition. The repetition is done until condition is true • Some common examples of this looping statements are : • while loop • for loop
  • 17. While loop It is used to repeat a block of statements until condition is true. Syntax: while(condition) { statements; increment/decrement; }
  • 18. For loop One of the most important feature of this loop is that the three actions can be taken at a time like variable initilisation, condition checking and increment/decrement. #include <stdio.h> #include <conio.h> void main() Syntax: { int a; for(initialisation; test-condition; incre/decre) for(i=0; i<=5; i++) { { printf("n"); statements; } }
  • 19. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com