SlideShare a Scribd company logo
1 of 14
Programming in C GOPIKA S,
KJC
Let us Learn
C Programming
Dr. GOPIKA S
Assistant Professor ,
Department of Computer Science,
KRISTU JAYANTI COLLEGE
1
Course Objective:
 To familiarize with the concepts of structured programming using C language.
Course Outcomes:
After successful completion of the course, the student will be able to:
 construct sequential, iterative solutions for problems
 differentiate between decision control structures and loop control structures
 distinguish between data representation through arrays, pointers, structures and unions
Text Books:
 Balagurusamy.E.Programming in ANSI .(7 th ed.). Tata McGraw Hill.
 Kamthane Ashok.(2003).Programming with ANSI and Turbo C.Pearson Education.
Programming in C GOPIKA S, KJC
2
What is C Programming Langauge?
 C is a general-purpose programming language that is extremely popular, simple,
and flexible to use.
 It is a structured programming language that is machine-independent and
extensively used to write various applications, Operating Systems like Windows,
UNIX and many other complex programs like Oracle database, Git, Python
interpreter, and more.
 C is a procedural Oriented Language the is base for the programming. If you
know ‘C,’ you can easily grasp the knowledge of the other programming
languages that uses the concept of ‘C’
 It is essential to have a background in computer memory mechanisms because it
is an important aspect when dealing with the C programming language.
Programming in C GOPIKA S, KJC
3
Programming in C GOPIKA S, KJC
In 1972, a great computer scientist Dennis Ritchie created a new
programming language called ‘C’ at the Bell Laboratories. It was created from
‘ALGOL’, ‘BCPL’ and ‘B’ programming languages. ‘C’ programming language
contains all the features of these languages and many more additional
concepts that make it unique from other languages.
‘C’ is a powerful programming language which is strongly associated with the
UNIX operating system. Even most of the UNIX operating system is coded in
‘C’. Initially ‘C’ programming was limited to the UNIX operating system, but as
it started spreading around the world, it became commercial, and many
compilers were released for cross-platform systems.
Today ‘C’ runs under a variety of operating systems and hardware platforms.
As it started evolving many different versions of the language were released.
At times it became difficult for the developers to keep up with the latest
version as the systems were running under the older versions. To assure that
‘C’ language will remain standard, American National Standards Institute
(ANSI) defined a commercial standard for ‘C’ language in 1989. Later, it was
approved by the International Standards Organization (ISO) in 1990.
‘C’ programming language is also called as ‘ANSI C’.
4
Applications of C
 ‘C’ language is widely used in embedded systems.
 It is used for developing system applications.
 It is widely used for developing desktop applications.
 Most of the applications by Adobe are developed using ‘C’ programming language.
 It is used for developing browsers and their extensions.
 It is used to develop databases. MySQL is the most popular database software which is
built using ‘C’.
 It is used in developing an operating system. Operating systems such as Apple’s OS X,
Microsoft’s Windows, and Symbian are developed using ‘C’ language. It is used for
developing desktop as well as mobile phone’s operating system.
 It is used for compiler production.
 It is widely used in IOT applications.
Programming in C GOPIKA S, KJC
5
Summary
 ‘C’ was developed by Dennis Ritchie in 1972 in BELL lab.
 It is a robust language.
 It is widely used in the software development field.
 It is a procedure and structure oriented language.
 It has the full support of various operating systems and hardware platforms.
 Many compilers are available for executing programs written in ‘C’.
 A compiler compiles the source file and generates an object file.
 A linker links all the object files together and creates one executable file.
 It is highly portable.
Programming in C GOPIKA S, KJC
6
Structure of a C program
 A C program is divided into different sections. There are six main sections to a
basic c program.
 The six sections are,
 Documentation
 Link
 Definition
 Global Declarations
 Main functions
 Subprograms
Programming in C GOPIKA S, KJC
7
Documentation Section
 The documentation section is the part of the program where the programmer
gives the details associated with the program. He usually gives the name of the
program, the details of the author and other details like the time of coding and
description. It gives anyone reading the code the overview of the code.
 Example
/**
* File Name: Helloworld.c
* Author: AABBCCDD
* date: 09/08/20121
* description: a program to display hello world
* no input needed
*/
Programming in C GOPIKA S, KJC
8
Link Section
 This part of the code is used to declare all the header files that will be used in the
program. This leads to the compiler being told to link the header files to the system
libraries.
Example
#include<stdio.h>
Definition Section
In this section, we define different constants. The keyword define is used in this part.
#define PI=3.14
Programming in C GOPIKA S, KJC
9
Global Declaration Section
This part of the code is the part where the global variables are declared. All the global variable used are
declared in this part. The user-defined functions are also declared in this part of the code.
 float area(float r);
 int a=7;
Main Function Section
Every C-programs needs to have the main function. Each main function contains 2 parts. A declaration part
and an Execution part. The declaration part is the part where all the variables are declared. The execution
begins with the curly brackets and ends with the curly close bracket. Both the declaration and execution
are inside the curly braces.
int main(void)
{
int a=10;
printf(" %d", a);
return 0;
}
Moving on to the next bit of this basic structure of a C program article,
Programming in C GOPIKA S, KJC
10
Sample Program
The C program here will find the area of a circle using a user-defined
and a global variable pi holding the value of pi
Programming in C GOPIKA S, KJC
// description: a program to calculate area of circle
// user enters the radius
#include<stdio.h>//link section
#define pi 3.14;//definition section
float area(float r);//global declaration
int main()//main function
{
float r;
printf(" Enter the radius:n");
scanf("%f",&r);
printf("the area is: %f",area(r));
return 0;
}
float area(float r)
{
return pi * r * r; //sub program
}
11
Programming in C GOPIKA S, KJC
12
Programming in C GOPIKA S, KJC
13
Thank you
Programming in C GOPIKA S, KJC
14

More Related Content

What's hot

1 introduction to c programming language
1 introduction to c programming language1 introduction to c programming language
1 introduction to c programming languageNarendra Soni
 
5.Hello World program Explanation. ||C Programming tutorial.
5.Hello World program Explanation. ||C Programming tutorial.5.Hello World program Explanation. ||C Programming tutorial.
5.Hello World program Explanation. ||C Programming tutorial.Fiaz Hussain
 
What is c#
What is c#What is c#
What is c#shwet18
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingSivant Kolhe
 
C Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYC Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYRajeshkumar Reddy
 
3. Introduction to C language ||Learn C Programming Complete.
3. Introduction to C language ||Learn C Programming Complete.3. Introduction to C language ||Learn C Programming Complete.
3. Introduction to C language ||Learn C Programming Complete.Fiaz Hussain
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesArghodeepPaul
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingAlpana Gupta
 
Programming languages
Programming languagesProgramming languages
Programming languagesSimon Mui
 

What's hot (20)

C Programming Language
C Programming LanguageC Programming Language
C Programming Language
 
Characteristics of c#
Characteristics of c#Characteristics of c#
Characteristics of c#
 
1 introduction to c programming language
1 introduction to c programming language1 introduction to c programming language
1 introduction to c programming language
 
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 language part 1
C language part  1C language part  1
C language part 1
 
C# Introduction brief
C# Introduction briefC# Introduction brief
C# Introduction brief
 
History of c#
History of c#History of c#
History of c#
 
Unit i
Unit iUnit i
Unit i
 
5.Hello World program Explanation. ||C Programming tutorial.
5.Hello World program Explanation. ||C Programming tutorial.5.Hello World program Explanation. ||C Programming tutorial.
5.Hello World program Explanation. ||C Programming tutorial.
 
C language
C languageC language
C language
 
What is c#
What is c#What is c#
What is c#
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
C Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYC Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDY
 
3. Introduction to C language ||Learn C Programming Complete.
3. Introduction to C language ||Learn C Programming Complete.3. Introduction to C language ||Learn C Programming Complete.
3. Introduction to C language ||Learn C Programming Complete.
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notes
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Programming assignment help
Programming assignment helpProgramming assignment help
Programming assignment help
 
Programming languages
Programming languagesProgramming languages
Programming languages
 

Similar to Learn C Programming Fundamentals

Why C is Called Structured Programming Language
Why C is Called Structured Programming LanguageWhy C is Called Structured Programming Language
Why C is Called Structured Programming LanguageSinbad Konick
 
Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)Nuzhat Memon
 
C programming presentation for university
C programming presentation for universityC programming presentation for university
C programming presentation for universitySheikh Monirul Hasan
 
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTTC programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTTBatra Centre
 
Introduction to programming with c,
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,Hossain Md Shakhawat
 
CS8251_QB_answers.pdf
CS8251_QB_answers.pdfCS8251_QB_answers.pdf
CS8251_QB_answers.pdfvino108206
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxSanketShah544615
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfSubramanyambharathis
 
C-PROGRAMMING-LANGUAGE.pptx
C-PROGRAMMING-LANGUAGE.pptxC-PROGRAMMING-LANGUAGE.pptx
C-PROGRAMMING-LANGUAGE.pptxDhirendraShahi2
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptxMugilvannan11
 
Introduction to C Programming (1).pdf
Introduction to C Programming (1).pdfIntroduction to C Programming (1).pdf
Introduction to C Programming (1).pdfSahidkhatiwada
 
TCS-NQT-Coding-Questions-@-Recruitmentindia.in_.pdf
TCS-NQT-Coding-Questions-@-Recruitmentindia.in_.pdfTCS-NQT-Coding-Questions-@-Recruitmentindia.in_.pdf
TCS-NQT-Coding-Questions-@-Recruitmentindia.in_.pdfAbhishekMGowda4
 

Similar to Learn C Programming Fundamentals (20)

Programming in c
Programming in cProgramming in c
Programming in c
 
Why C is Called Structured Programming Language
Why C is Called Structured Programming LanguageWhy C is Called Structured Programming Language
Why C is Called Structured Programming Language
 
Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)
 
C programming presentation for university
C programming presentation for universityC programming presentation for university
C programming presentation for university
 
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTTC programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
 
Introduction to programming with c,
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,
 
CS3251-_PIC
CS3251-_PICCS3251-_PIC
CS3251-_PIC
 
CS8251_QB_answers.pdf
CS8251_QB_answers.pdfCS8251_QB_answers.pdf
CS8251_QB_answers.pdf
 
What is C.docx
What is C.docxWhat is C.docx
What is C.docx
 
C lecture notes new
C lecture notes newC lecture notes new
C lecture notes new
 
Unit 2 ppt
Unit 2 pptUnit 2 ppt
Unit 2 ppt
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptx
 
chapter 1.pptx
chapter 1.pptxchapter 1.pptx
chapter 1.pptx
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
 
C-PROGRAMMING-LANGUAGE.pptx
C-PROGRAMMING-LANGUAGE.pptxC-PROGRAMMING-LANGUAGE.pptx
C-PROGRAMMING-LANGUAGE.pptx
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
 
C programming
C programming C programming
C programming
 
Introduction to C Programming (1).pdf
Introduction to C Programming (1).pdfIntroduction to C Programming (1).pdf
Introduction to C Programming (1).pdf
 
TCS-NQT-Coding-Questions-@-Recruitmentindia.in_.pdf
TCS-NQT-Coding-Questions-@-Recruitmentindia.in_.pdfTCS-NQT-Coding-Questions-@-Recruitmentindia.in_.pdf
TCS-NQT-Coding-Questions-@-Recruitmentindia.in_.pdf
 
C program
C programC program
C program
 

More from GopikaS12

Deadlock _Classic problems.pptx
Deadlock _Classic problems.pptxDeadlock _Classic problems.pptx
Deadlock _Classic problems.pptxGopikaS12
 
Introduction to Tree .pptx
Introduction to Tree .pptxIntroduction to Tree .pptx
Introduction to Tree .pptxGopikaS12
 
C formatted and unformatted input and output constructs
C  formatted and unformatted input and output constructsC  formatted and unformatted input and output constructs
C formatted and unformatted input and output constructsGopikaS12
 
Heap creation from elements - Step by step Approach
Heap creation  from elements - Step by step Approach Heap creation  from elements - Step by step Approach
Heap creation from elements - Step by step Approach GopikaS12
 
Data Structures: Stack Operations
Data Structures:    Stack OperationsData Structures:    Stack Operations
Data Structures: Stack OperationsGopikaS12
 
Net content in computer architecture
Net content in computer  architectureNet content in computer  architecture
Net content in computer architectureGopikaS12
 

More from GopikaS12 (7)

Deadlock _Classic problems.pptx
Deadlock _Classic problems.pptxDeadlock _Classic problems.pptx
Deadlock _Classic problems.pptx
 
Introduction to Tree .pptx
Introduction to Tree .pptxIntroduction to Tree .pptx
Introduction to Tree .pptx
 
C formatted and unformatted input and output constructs
C  formatted and unformatted input and output constructsC  formatted and unformatted input and output constructs
C formatted and unformatted input and output constructs
 
Heap creation from elements - Step by step Approach
Heap creation  from elements - Step by step Approach Heap creation  from elements - Step by step Approach
Heap creation from elements - Step by step Approach
 
Data Structures: Stack Operations
Data Structures:    Stack OperationsData Structures:    Stack Operations
Data Structures: Stack Operations
 
Net content in computer architecture
Net content in computer  architectureNet content in computer  architecture
Net content in computer architecture
 
It unit 1
It   unit 1It   unit 1
It unit 1
 

Recently uploaded

MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 

Recently uploaded (20)

MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 

Learn C Programming Fundamentals

  • 1. Programming in C GOPIKA S, KJC Let us Learn C Programming Dr. GOPIKA S Assistant Professor , Department of Computer Science, KRISTU JAYANTI COLLEGE 1
  • 2. Course Objective:  To familiarize with the concepts of structured programming using C language. Course Outcomes: After successful completion of the course, the student will be able to:  construct sequential, iterative solutions for problems  differentiate between decision control structures and loop control structures  distinguish between data representation through arrays, pointers, structures and unions Text Books:  Balagurusamy.E.Programming in ANSI .(7 th ed.). Tata McGraw Hill.  Kamthane Ashok.(2003).Programming with ANSI and Turbo C.Pearson Education. Programming in C GOPIKA S, KJC 2
  • 3. What is C Programming Langauge?  C is a general-purpose programming language that is extremely popular, simple, and flexible to use.  It is a structured programming language that is machine-independent and extensively used to write various applications, Operating Systems like Windows, UNIX and many other complex programs like Oracle database, Git, Python interpreter, and more.  C is a procedural Oriented Language the is base for the programming. If you know ‘C,’ you can easily grasp the knowledge of the other programming languages that uses the concept of ‘C’  It is essential to have a background in computer memory mechanisms because it is an important aspect when dealing with the C programming language. Programming in C GOPIKA S, KJC 3
  • 4. Programming in C GOPIKA S, KJC In 1972, a great computer scientist Dennis Ritchie created a new programming language called ‘C’ at the Bell Laboratories. It was created from ‘ALGOL’, ‘BCPL’ and ‘B’ programming languages. ‘C’ programming language contains all the features of these languages and many more additional concepts that make it unique from other languages. ‘C’ is a powerful programming language which is strongly associated with the UNIX operating system. Even most of the UNIX operating system is coded in ‘C’. Initially ‘C’ programming was limited to the UNIX operating system, but as it started spreading around the world, it became commercial, and many compilers were released for cross-platform systems. Today ‘C’ runs under a variety of operating systems and hardware platforms. As it started evolving many different versions of the language were released. At times it became difficult for the developers to keep up with the latest version as the systems were running under the older versions. To assure that ‘C’ language will remain standard, American National Standards Institute (ANSI) defined a commercial standard for ‘C’ language in 1989. Later, it was approved by the International Standards Organization (ISO) in 1990. ‘C’ programming language is also called as ‘ANSI C’. 4
  • 5. Applications of C  ‘C’ language is widely used in embedded systems.  It is used for developing system applications.  It is widely used for developing desktop applications.  Most of the applications by Adobe are developed using ‘C’ programming language.  It is used for developing browsers and their extensions.  It is used to develop databases. MySQL is the most popular database software which is built using ‘C’.  It is used in developing an operating system. Operating systems such as Apple’s OS X, Microsoft’s Windows, and Symbian are developed using ‘C’ language. It is used for developing desktop as well as mobile phone’s operating system.  It is used for compiler production.  It is widely used in IOT applications. Programming in C GOPIKA S, KJC 5
  • 6. Summary  ‘C’ was developed by Dennis Ritchie in 1972 in BELL lab.  It is a robust language.  It is widely used in the software development field.  It is a procedure and structure oriented language.  It has the full support of various operating systems and hardware platforms.  Many compilers are available for executing programs written in ‘C’.  A compiler compiles the source file and generates an object file.  A linker links all the object files together and creates one executable file.  It is highly portable. Programming in C GOPIKA S, KJC 6
  • 7. Structure of a C program  A C program is divided into different sections. There are six main sections to a basic c program.  The six sections are,  Documentation  Link  Definition  Global Declarations  Main functions  Subprograms Programming in C GOPIKA S, KJC 7
  • 8. Documentation Section  The documentation section is the part of the program where the programmer gives the details associated with the program. He usually gives the name of the program, the details of the author and other details like the time of coding and description. It gives anyone reading the code the overview of the code.  Example /** * File Name: Helloworld.c * Author: AABBCCDD * date: 09/08/20121 * description: a program to display hello world * no input needed */ Programming in C GOPIKA S, KJC 8
  • 9. Link Section  This part of the code is used to declare all the header files that will be used in the program. This leads to the compiler being told to link the header files to the system libraries. Example #include<stdio.h> Definition Section In this section, we define different constants. The keyword define is used in this part. #define PI=3.14 Programming in C GOPIKA S, KJC 9
  • 10. Global Declaration Section This part of the code is the part where the global variables are declared. All the global variable used are declared in this part. The user-defined functions are also declared in this part of the code.  float area(float r);  int a=7; Main Function Section Every C-programs needs to have the main function. Each main function contains 2 parts. A declaration part and an Execution part. The declaration part is the part where all the variables are declared. The execution begins with the curly brackets and ends with the curly close bracket. Both the declaration and execution are inside the curly braces. int main(void) { int a=10; printf(" %d", a); return 0; } Moving on to the next bit of this basic structure of a C program article, Programming in C GOPIKA S, KJC 10
  • 11. Sample Program The C program here will find the area of a circle using a user-defined and a global variable pi holding the value of pi Programming in C GOPIKA S, KJC // description: a program to calculate area of circle // user enters the radius #include<stdio.h>//link section #define pi 3.14;//definition section float area(float r);//global declaration int main()//main function { float r; printf(" Enter the radius:n"); scanf("%f",&r); printf("the area is: %f",area(r)); return 0; } float area(float r) { return pi * r * r; //sub program } 11
  • 12. Programming in C GOPIKA S, KJC 12
  • 13. Programming in C GOPIKA S, KJC 13
  • 14. Thank you Programming in C GOPIKA S, KJC 14