SlideShare a Scribd company logo
1 of 130
C Programming ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Preparing to program ,[object Object],[object Object],[object Object],[object Object]
Feature of C Program ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Structured Language ,[object Object],[object Object],[object Object]
Portability ,[object Object],[object Object],[object Object]
General Purpose Language ,[object Object],[object Object],[object Object],[object Object],[object Object]
Code Re usability and Ability to  Customize and Extend ,[object Object],[object Object],[object Object],[object Object],[object Object]
Limited number  of keywords and unix library function ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
'C' program structure ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Writing,compiling and executing ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Recap of previous session ,[object Object],[object Object],[object Object],[object Object]
Introduction ,[object Object],[object Object],[object Object],[object Object]
Data types ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
'C' has five basic built in data type   ,[object Object],[object Object],[object Object],[object Object],[object Object]
Void is used to ,[object Object],[object Object],[object Object],[object Object]
Declaring a variable ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Assigning values ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Type Modifier ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Character ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Integer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Real number ,[object Object],[object Object],[object Object],[object Object]
Signed and unsigned prefixes ,[object Object],[object Object],[object Object]
Character Set ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Keywords and Indentifier ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
keywords ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Constants ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C supports several types constant ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Escape sequences ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Access modifier ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Operator ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Three general classes of operator ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Arithmetic Operators ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
casting ,[object Object],[object Object],[object Object],[object Object],[object Object]
Implicit casting ,[object Object],[object Object],[object Object],[object Object]
Explicit casting ,[object Object],[object Object],[object Object],[object Object],[object Object]
Linking with math library ,[object Object],[object Object],[object Object],[object Object]
Unary operator ,[object Object],[object Object],[object Object],[object Object],[object Object]
Increment and Decrement ,[object Object],[object Object],[object Object],[object Object],[object Object]
Postfix and Prefix ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Relational and Logical operator ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Conditional (:?) Operator ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Recap of previous session ,[object Object],[object Object],[object Object]
POINTERS ,[object Object],[object Object],[object Object]
POINTERS  CONT.. ,[object Object],[object Object],[object Object],[object Object]
POINTERS  CONT.... ,[object Object],[object Object],[object Object],[object Object]
POINTERS ,[object Object],[object Object],[object Object],[object Object]
POINTERS ,[object Object],[object Object],[object Object],[object Object],[object Object]
NULL POINTERS ,[object Object],[object Object],[object Object],[object Object]
NULL POINTERS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Equivalence in Array and pointer ,[object Object],[object Object],[object Object],[object Object]
Arrays and Pointers as Function Arguments ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
String ,[object Object],[object Object],[object Object],[object Object]
Preprocessor Directives ,[object Object],[object Object],[object Object],[object Object],[object Object]
Notes  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Macros ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Getchar( ) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Putchar( ) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Printf( ) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Scanf( ) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
List all format ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Mixed data Output ,[object Object],[object Object],[object Object],[object Object]
Types ,[object Object],[object Object]
Types ,[object Object],[object Object],[object Object],[object Object]
Types cont... ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Constants A constant is just an immediate, absolute value found in an expression. The simplest constants are decimal integers, e.g. 0, 1, 2, 123 . Occasionally it is useful to specify constants in base 8 or base 16 (octal or hexadecimal); this is done by prefixing an extra 0 (zero) for octal, or 0x for hexadecimal: the constants 100, 0144, and 0x64 all represent the same number. (If you're not using these non-decimal constants, just remember not to use any leading zeroes. If you accidentally write 0123 intending to get one hundred and twenty three, you'll get 83 instead, which is 123 base 8.)
Declaration ,[object Object],[object Object],[object Object]
Function calls ,[object Object],[object Object],[object Object],[object Object]
Expression statement ,[object Object],[object Object],[object Object],[object Object],[object Object]
If statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Boolean expression ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
While loop ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
For loop ,[object Object],[object Object]
Break and continue  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Character output  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
File pointer and Fopen ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
I/O with file pointer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Predefined Stream ,[object Object],[object Object],[object Object],[object Object],[object Object]
Closing files  ,[object Object],[object Object]
Character Input/output  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
UNIX File Redirection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Memory Management Dynamic memory management
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Introduction / Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Memory Leak  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Memory Leak  cont… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Valgrind
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Valgrind   cont…
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Valgrind  cont…
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Valgrind  cont…
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Valgrind  cont…
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Valgrind  cont…
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Valgrind  cont…
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Case studies
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Case studies
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Case studies
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Case studies
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Case studies
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Valgrind  cont…
[object Object],[object Object],[object Object],Bounds Checker
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Bounds Checker  cont…
[object Object],[object Object],[object Object],[object Object],Bounds Checker  cont …
[object Object],[object Object],[object Object],[object Object],[object Object],Bounds Checker  cont…
Case studies ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],Case studies
[object Object],[object Object],[object Object],[object Object],Case studies
[object Object],[object Object],[object Object],[object Object],Case studies
[object Object],[object Object],[object Object],Case studies
[object Object],[object Object],[object Object],Case studies  cont…
[object Object],[object Object],[object Object],[object Object],[object Object],Summary
[object Object],[object Object],[object Object],[object Object],[object Object],Reference
Linked list  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Concept of linked list ,[object Object],[object Object],[object Object],[object Object],[object Object]
Arrays  ,[object Object]
Array cont....... ,[object Object]
Array cont....... ,[object Object]
Array cont....... ,[object Object],[object Object],[object Object],[object Object]
Other String Handling Functions ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],Programs with Several Files
Advantage of using several files The main advantages of spreading a program across several files are:  Teams of programmers can work on programs. Each programmer works on a different file.  An object oriented style can be used. Each file defines a particular type of object as a datatype and operations on that object as functions. The implementation of the object can be kept private from the rest of the program. This makes for well structured programs which are easy to maintain.  Files can contain all functions from a related group. For Example all matrix operations. These can then be accessed like a function library.  Well implemented objects or function definitions can be re-used in other programs, reducing development time.  In very large programs each major function can occupy a file to itself. Any lower level functions used to implement them can be kept in the same file.  Then programmers who call the major function need not be distracted by all the lower level work.  When changes are made to a file, only that file need be re-compiled to rebuild the program. The UNIX make facility is very useful for rebuilding multi-file programs in this way.
How to Divide a Program between Several Files Where a function is spread over several files, each file will contain one or more functions. One file will include main while the others will contain functions which are called by others. These other files can be treated as a library of functions.  Programmers usually start designing a program by dividing the problem into easily managed sections. Each of these sections might be implemented as one or more functions. All functions from each section will usually live in a single file.  Where objects are implemented as data structures, it is usual to to keep all functions which access that object in the same file. The advantages of this are;  The object can easily be re-used in other programs.
How to Divide a Program between Several Files All related functions are stored together.  Later changes to the object require only one file to be modified.  Where the file contains the definition of an object, or functions which return values, there is a further restriction on calling these functions from another file. Unless functions in another file are told about the object or function definitions, they will be unable to compile them correctly.  The best solution to this problem is to write a header file for each of the C files. This will have the same name as the C file, but ending in .h. The header file contains definitions of all the functions used in the C file.  Whenever a function in another file calls a function from our C file, it can define the function by making a #include of the appropriate .h file.
Organization of Data in File Any file must have its data organized in a certain order. This will typically be:  A preamble consisting of #defined constants, #included header files and typedefs of important data types  Declaration of global and external variables. Global variables may also be initialized here.  One or more functions.  The order of items is important, since every object must be defined before it can be used. Functions which return values must be defined before they are called. This definition might be one of the following:
Organization of Data in File Where the function is defined and called in the same file, a full declaration of the function can be placed ahead of any call to the function.  If the function is called from a file where it is not defined, a prototype should appear before the call to the function.  A function defined as  float find_max(float a, float b, float c) {  /* etc ... ... */ would have a prototype of  float find_max(float a, float b, float c);  The prototype may occur among the global variables at the start of the source file. Alternatively it may be declared in a header file which is read in using a #include.  It is important to remember that all C objects should be declared before use.
[object Object],[object Object],[object Object],[object Object],[object Object],Compiling Multi-File Programs
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Separate Compilation
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Using make with Multi-File Programs
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Using make with Multi-File Programs CONT....
Reading lines ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Reading number ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
IntelliBitz Technologies Training Division 168, Medavakkam Main Road Madipakkam, Chennai 91. PH: +91 044 2247 5106 www.intellibitz.com [email_address]

More Related Content

What's hot

MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdfMANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in CSahithi Naraparaju
 
What is keyword in c programming
What is keyword in c programmingWhat is keyword in c programming
What is keyword in c programmingRumman Ansari
 
Basic C Programming language
Basic C Programming languageBasic C Programming language
Basic C Programming languageAbhishek Soni
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programmingRumman Ansari
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiersNilimesh Halder
 
Decision making and branching in c programming
Decision making and branching in c programmingDecision making and branching in c programming
Decision making and branching in c programmingPriyansh Thakar
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C ProgrammingQazi Shahzad Ali
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILEDipta Saha
 
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdfSTRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constantsvinay arora
 
Union in c language
Union  in c languageUnion  in c language
Union in c languagetanmaymodi4
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#Dr.Neeraj Kumar Pandey
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programmingChitrank Dixit
 

What's hot (20)

MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdfMANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
 
Datatypes in c
Datatypes in cDatatypes in c
Datatypes in c
 
What is keyword in c programming
What is keyword in c programmingWhat is keyword in c programming
What is keyword in c programming
 
Basic C Programming language
Basic C Programming languageBasic C Programming language
Basic C Programming language
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programming
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
 
Decision making and branching in c programming
Decision making and branching in c programmingDecision making and branching in c programming
Decision making and branching in c programming
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
Data types in C
Data types in CData types in C
Data types in C
 
Function C programming
Function C programmingFunction C programming
Function C programming
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdfSTRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constants
 
C program
C programC program
C program
 
Union in c language
Union  in c languageUnion  in c language
Union in c language
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 

Viewers also liked (20)

Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
IT BOOK
IT BOOKIT BOOK
IT BOOK
 
Hands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming LanguageHands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming Language
 
Computer Literacy Beginers
Computer Literacy BeginersComputer Literacy Beginers
Computer Literacy Beginers
 
Teamwork Works!
Teamwork Works!Teamwork Works!
Teamwork Works!
 
Soc mobyear2
Soc mobyear2Soc mobyear2
Soc mobyear2
 
PageMaker - R.D.sivakumar
PageMaker - R.D.sivakumarPageMaker - R.D.sivakumar
PageMaker - R.D.sivakumar
 
Li fi
Li fiLi fi
Li fi
 
Pagemaker handout by Engr. Spark Ovadje
Pagemaker handout by Engr. Spark OvadjePagemaker handout by Engr. Spark Ovadje
Pagemaker handout by Engr. Spark Ovadje
 
Page maker
Page makerPage maker
Page maker
 
String operation
String operationString operation
String operation
 
Robotics workshop PPT
Robotics  workshop PPTRobotics  workshop PPT
Robotics workshop PPT
 
Objective-C
Objective-CObjective-C
Objective-C
 
Css & dhtml
Css  & dhtmlCss  & dhtml
Css & dhtml
 
Objective c slide I
Objective c slide IObjective c slide I
Objective c slide I
 
Ip Spoofing
Ip SpoofingIp Spoofing
Ip Spoofing
 
My ppt..priya
My ppt..priyaMy ppt..priya
My ppt..priya
 
C programming & data structure [character strings & string functions]
C programming & data structure   [character strings & string functions]C programming & data structure   [character strings & string functions]
C programming & data structure [character strings & string functions]
 

Similar to CProgrammingTutorial

Similar to CProgrammingTutorial (20)

C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
C
CC
C
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
C programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer CentreC programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer Centre
 
C language ppt
C language pptC language ppt
C language ppt
 
history of c.ppt
history of c.ppthistory of c.ppt
history of c.ppt
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
 
Cnotes
CnotesCnotes
Cnotes
 
Ch02
Ch02Ch02
Ch02
 
C introduction
C introductionC introduction
C introduction
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
C programming language
C programming languageC programming language
C programming language
 
Basics of c
Basics of cBasics of c
Basics of c
 
C programming notes.pdf
C programming notes.pdfC programming notes.pdf
C programming notes.pdf
 
C notes
C notesC notes
C notes
 
C programming notes
C programming notesC programming notes
C programming notes
 
Msc prev updated
Msc prev updatedMsc prev updated
Msc prev updated
 

More from Muthuselvam RS

UpsilonPiEpsilon-UniversityOfBridgeport-May1997
UpsilonPiEpsilon-UniversityOfBridgeport-May1997UpsilonPiEpsilon-UniversityOfBridgeport-May1997
UpsilonPiEpsilon-UniversityOfBridgeport-May1997Muthuselvam RS
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer ReferenceMuthuselvam RS
 

More from Muthuselvam RS (7)

UpsilonPiEpsilon-UniversityOfBridgeport-May1997
UpsilonPiEpsilon-UniversityOfBridgeport-May1997UpsilonPiEpsilon-UniversityOfBridgeport-May1997
UpsilonPiEpsilon-UniversityOfBridgeport-May1997
 
Spring User Guide
Spring User GuideSpring User Guide
Spring User Guide
 
Gears User Guide
Gears User GuideGears User Guide
Gears User Guide
 
Ant User Guide
Ant User GuideAnt User Guide
Ant User Guide
 
Subversion User Guide
Subversion User GuideSubversion User Guide
Subversion User Guide
 
PHP Web Programming
PHP Web ProgrammingPHP Web Programming
PHP Web Programming
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer Reference
 

Recently uploaded

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringWSO2
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceIES VE
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 

CProgrammingTutorial

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65. Constants A constant is just an immediate, absolute value found in an expression. The simplest constants are decimal integers, e.g. 0, 1, 2, 123 . Occasionally it is useful to specify constants in base 8 or base 16 (octal or hexadecimal); this is done by prefixing an extra 0 (zero) for octal, or 0x for hexadecimal: the constants 100, 0144, and 0x64 all represent the same number. (If you're not using these non-decimal constants, just remember not to use any leading zeroes. If you accidentally write 0123 intending to get one hundred and twenty three, you'll get 83 instead, which is 123 base 8.)
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81. Memory Management Dynamic memory management
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119. Advantage of using several files The main advantages of spreading a program across several files are: Teams of programmers can work on programs. Each programmer works on a different file. An object oriented style can be used. Each file defines a particular type of object as a datatype and operations on that object as functions. The implementation of the object can be kept private from the rest of the program. This makes for well structured programs which are easy to maintain. Files can contain all functions from a related group. For Example all matrix operations. These can then be accessed like a function library. Well implemented objects or function definitions can be re-used in other programs, reducing development time. In very large programs each major function can occupy a file to itself. Any lower level functions used to implement them can be kept in the same file. Then programmers who call the major function need not be distracted by all the lower level work. When changes are made to a file, only that file need be re-compiled to rebuild the program. The UNIX make facility is very useful for rebuilding multi-file programs in this way.
  • 120. How to Divide a Program between Several Files Where a function is spread over several files, each file will contain one or more functions. One file will include main while the others will contain functions which are called by others. These other files can be treated as a library of functions. Programmers usually start designing a program by dividing the problem into easily managed sections. Each of these sections might be implemented as one or more functions. All functions from each section will usually live in a single file. Where objects are implemented as data structures, it is usual to to keep all functions which access that object in the same file. The advantages of this are; The object can easily be re-used in other programs.
  • 121. How to Divide a Program between Several Files All related functions are stored together. Later changes to the object require only one file to be modified. Where the file contains the definition of an object, or functions which return values, there is a further restriction on calling these functions from another file. Unless functions in another file are told about the object or function definitions, they will be unable to compile them correctly. The best solution to this problem is to write a header file for each of the C files. This will have the same name as the C file, but ending in .h. The header file contains definitions of all the functions used in the C file. Whenever a function in another file calls a function from our C file, it can define the function by making a #include of the appropriate .h file.
  • 122. Organization of Data in File Any file must have its data organized in a certain order. This will typically be: A preamble consisting of #defined constants, #included header files and typedefs of important data types Declaration of global and external variables. Global variables may also be initialized here. One or more functions. The order of items is important, since every object must be defined before it can be used. Functions which return values must be defined before they are called. This definition might be one of the following:
  • 123. Organization of Data in File Where the function is defined and called in the same file, a full declaration of the function can be placed ahead of any call to the function. If the function is called from a file where it is not defined, a prototype should appear before the call to the function. A function defined as float find_max(float a, float b, float c) { /* etc ... ... */ would have a prototype of float find_max(float a, float b, float c); The prototype may occur among the global variables at the start of the source file. Alternatively it may be declared in a header file which is read in using a #include. It is important to remember that all C objects should be declared before use.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130. IntelliBitz Technologies Training Division 168, Medavakkam Main Road Madipakkam, Chennai 91. PH: +91 044 2247 5106 www.intellibitz.com [email_address]