SlideShare a Scribd company logo
1 of 62
Download to read offline
Computer
Programming-I
Unit-I
Introducton
By
Mr. Harshal S. Hemane
Assistant Professor,
Department of Electronics & Communication Engineering,
Bharati Vidyapeeth
(Deemed to be University)
College of Engineering, Pune
Computer Programming
Computer programming is the process of writing code to
facilitate specific actions in a computer, application or software
program, and instructs them on how to perform.
Basic Type of Programming Language
C Language
The C language is a basic programming language and it is a very popular
language, particularly used in embedded system ,game programming,
Because C language includes the additional packing of the C++, Every
programmer uses this language because it makes programs faster .
However the value of this language gives the reusability of C++ to get the
slight increase in performance with C language
Why to Learn C Programming?
• C programming language is a MUST for students and
working professionals to become a great Software
Engineer specially when they are working in Software
Development Domain. I will list down some of the key
advantages of learning C Programming:
• Easy to learn
• Structured language
• It produces efficient programs
• It can handle low-level activities
• It can be compiled on a variety of computer platforms
Facts about C
• C was invented to write an operating system called
UNIX.
• C is a successor of B language which was introduced
around the early 1970s.
• The language was formalized in 1988 by the American
National Standard Institute (ANSI).
• The UNIX OS was totally written in C.
• Today C is the most widely used and popular System
Programming Language.
• Most of the state-of-the-art software have been
implemented using C
comparison
C Vs C++ Vs Java
APPLICATION OF C
“Structure of C Program”
Program has six section The six sections are
1. Documentation
2.Link
3. Definition
4. Global Declarations
5.Main functions
6. Subprograms
1.Documentation Section
the Documentation Section consists of a set of
comment lines giving the name of the
Programmer, date, and other details about the
program. The documentation section helps
anyone to get an overview of the program.
example
/*
* File Name: Helloworld.c
* Author: ABC(name of programmer)
* date: 25/11/2020
* description: a program to display hello world
* no input needed
*/
IMP
Single line comments
//sum of two numbers
Multi-line comments
/*Comment*/
2. Link Section
• The Link section provides instructions to the compiler to
link functions from the system library such as using the
#include directive.
• 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.
Some Examples
#include<stdio.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
3. Definition
All the symbolic constants are written in the
definition section by using the #define
directive.
Examples
#define PI=3.14
#define
4. Global Declarations
• Global Declaration Section contains the global
declaration of user-defined functions and
Variables. There are some variables that are
used in more than one function. Such
variables are called Global Variables and are
declared in the global declaration section that
is outside of all the functions
5.Main Sections
• 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 part
begins with the curly brackets and ends with
the curly close bracket. Both the declaration
and execution part are inside the curly brace
6. Subprogram Section
The subprogram section contains all the user-
defined functions that are used to perform a
specific task. These user-defined functions are
called in the main function. User-defined
functions are generally placed just after the
main() function, although they may appear in
any order
Identifiers,
Identifiers are names for entities in a C program,
such as variables, arrays, functions, structures,
unions and labels. An identifier can be composed
only of uppercase, lowercase letters, underscore
and digits, but should start only with an alphabet
or an underscore. If the identifier is not used in
an external link process, then it is called as
internal. Example: Local variable. If the identifier
is used in an external link process, then it is called
as external. Example: Global variable
Rules for constructing identifiers
• 1. The first character in an identifier must be an
alphabet or an underscore and can be followed only by
any number alphabets, or digits or underscores.
2. They must not begin with a digit.
3. Uppercase and lowercase letters are distinct. That
is, identifiers are case sensitive.
4. Commas or blank spaces are not allowed within an
identifier.
5. Keywords cannot be used as an identifier.
6. Identifiers should not be of length more than 31
characters.
7. Identifiers must be meaningful, short, quickly and
easily typed and easily read
Valid
identifiers: total sum average _x
y_ mark_1 x1
Invalid identifiers
1x - begins with a digit
char - reserved word
x+y - special character
Differentiate between Keywords
words and identifiers
What are Data types in C
Programming?
In C programming, data types are just the same
what their name suggests. They represent the
kind of data to store. They are used to declare
several functions as well as variables in a
program
C – Constant
• C Constants are also like normal variables. But,
only difference is, their values can not be
modified by the program once they are
defined. Constants refer to fixed values. They
are also called as literals. Constants may be
belonging to any of the data type.
Variable in C
• C variable is a named location in a memory
where a program can manipulate the data.
This location is used to hold the value of the
variable.
• The value of the C variable may get change in
the program.
• C variable might be belonging to any of the
data type like int, float, char etc.
Rules for naming C variable:
• Variable name must begin with letter or
underscore.
• Variables are case sensitive
• They can be constructed with digits, letters.
• No special symbols are allowed other than
underscore.
• average, height, age, total are some examples
for variable name
Operators in C
Operators are the foundation of any
programming language. Thus the functionality
of C programming language is incomplete
without the use of operators. We can define
operators as symbols that help us to perform
specific mathematical and logical
computations on operands. In other words,
we can say that an operator operates the
operands
1.Arithmetic Operators
An arithmetic operator performs mathematical
operations such as addition, subtraction,
multiplication, division etc on numerical
values
• Output
• a+b = 13
• a-b = 5
• a*b = 36
• a/b = 2 Remainder when a divided by b=1
Bitwise Operator in C
• The bitwise operators are the operators used
to perform the operations on the data at the
bit-level. When we perform the bitwise
operations, then it is also known as bit-level
programming.
• It consists of two digits, either 0 or 1. It is
mainly used in numerical computations to
make the calculations faster.
Relational Operators
• These Operators are used to check the
relationship between the two operands. If the
relation is true, it returns 1; if the relation is
false, it returns value 0. Relational operators
are used in decision making and loops.
3.logical operators
• A logical operator is a symbol or word used to
connect two or more expressions such that
the value of the compound expression
produced depends only on that of the original
expressions and on the meaning of the
operator. Common logical operators include
AND, OR, and NOT.
&& (LOGICAL AND Operator)
Assignment Operators
• Assignment operators are used when the
value is to be assigned to an identifier, a
variable. With execution of assignment
operators, value at the right is assigned to the
left. The destination variable loses the old
value; i.e. old value is over ridden with the
new value. If previous value is also required; it
should be saved in some other variables.
SAMPLE PROGRAMS
Thank You

More Related Content

Similar to CP c++ programing project Unit 1 intro.pdf

M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageDr.Florence Dayana
 
Introduction to the c programming language (amazing and easy book for beginners)
Introduction to the c programming language (amazing and easy book for beginners)Introduction to the c programming language (amazing and easy book for beginners)
Introduction to the c programming language (amazing and easy book for beginners)mujeeb memon
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxVigneshkumar Ponnusamy
 
358 33 powerpoint-slides_1-introduction-c_chapter-1
358 33 powerpoint-slides_1-introduction-c_chapter-1358 33 powerpoint-slides_1-introduction-c_chapter-1
358 33 powerpoint-slides_1-introduction-c_chapter-1sumitbardhan
 
c_programming.pdf
c_programming.pdfc_programming.pdf
c_programming.pdfHome
 
object oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxobject oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxurvashipundir04
 
Chapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptChapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptANISHYAPIT
 
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
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.pptManiMala75
 

Similar to CP c++ programing project Unit 1 intro.pdf (20)

Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
 
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C Language
 
Rr
RrRr
Rr
 
Introduction to the c programming language (amazing and easy book for beginners)
Introduction to the c programming language (amazing and easy book for beginners)Introduction to the c programming language (amazing and easy book for beginners)
Introduction to the c programming language (amazing and easy book for beginners)
 
C pdf
C pdfC pdf
C pdf
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
 
358 33 powerpoint-slides_1-introduction-c_chapter-1
358 33 powerpoint-slides_1-introduction-c_chapter-1358 33 powerpoint-slides_1-introduction-c_chapter-1
358 33 powerpoint-slides_1-introduction-c_chapter-1
 
c_programming.pdf
c_programming.pdfc_programming.pdf
c_programming.pdf
 
C language ppt
C language pptC language ppt
C language ppt
 
object oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxobject oriented programming part inheritance.pptx
object oriented programming part inheritance.pptx
 
C language
C language C language
C language
 
C programming
C programmingC programming
C programming
 
history of c.ppt
history of c.ppthistory of c.ppt
history of c.ppt
 
Chapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptChapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this ppt
 
C programming
C programming C programming
C programming
 
Introduction of C++ By Pawan Thakur
Introduction of C++ By Pawan ThakurIntroduction of C++ By Pawan Thakur
Introduction of C++ By Pawan Thakur
 
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
 
c programming session 1.pptx
c programming session 1.pptxc programming session 1.pptx
c programming session 1.pptx
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
 

Recently uploaded

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
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
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 

Recently uploaded (20)

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
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
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
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
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 

CP c++ programing project Unit 1 intro.pdf

  • 1. Computer Programming-I Unit-I Introducton By Mr. Harshal S. Hemane Assistant Professor, Department of Electronics & Communication Engineering, Bharati Vidyapeeth (Deemed to be University) College of Engineering, Pune
  • 2. Computer Programming Computer programming is the process of writing code to facilitate specific actions in a computer, application or software program, and instructs them on how to perform.
  • 3. Basic Type of Programming Language
  • 4. C Language The C language is a basic programming language and it is a very popular language, particularly used in embedded system ,game programming, Because C language includes the additional packing of the C++, Every programmer uses this language because it makes programs faster . However the value of this language gives the reusability of C++ to get the slight increase in performance with C language
  • 5. Why to Learn C Programming? • C programming language is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Software Development Domain. I will list down some of the key advantages of learning C Programming: • Easy to learn • Structured language • It produces efficient programs • It can handle low-level activities • It can be compiled on a variety of computer platforms
  • 6. Facts about C • C was invented to write an operating system called UNIX. • C is a successor of B language which was introduced around the early 1970s. • The language was formalized in 1988 by the American National Standard Institute (ANSI). • The UNIX OS was totally written in C. • Today C is the most widely used and popular System Programming Language. • Most of the state-of-the-art software have been implemented using C
  • 9. “Structure of C Program” Program has six section The six sections are 1. Documentation 2.Link 3. Definition 4. Global Declarations 5.Main functions 6. Subprograms
  • 10.
  • 11. 1.Documentation Section the Documentation Section consists of a set of comment lines giving the name of the Programmer, date, and other details about the program. The documentation section helps anyone to get an overview of the program.
  • 12. example /* * File Name: Helloworld.c * Author: ABC(name of programmer) * date: 25/11/2020 * description: a program to display hello world * no input needed */
  • 13. IMP Single line comments //sum of two numbers Multi-line comments /*Comment*/
  • 14. 2. Link Section • The Link section provides instructions to the compiler to link functions from the system library such as using the #include directive. • 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. Some Examples #include<stdio.h> #include<stdio.h> #include<conio.h> #include<math.h>
  • 15.
  • 16. 3. Definition All the symbolic constants are written in the definition section by using the #define directive. Examples #define PI=3.14 #define
  • 17.
  • 18. 4. Global Declarations • Global Declaration Section contains the global declaration of user-defined functions and Variables. There are some variables that are used in more than one function. Such variables are called Global Variables and are declared in the global declaration section that is outside of all the functions
  • 19.
  • 20. 5.Main Sections • 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 part begins with the curly brackets and ends with the curly close bracket. Both the declaration and execution part are inside the curly brace
  • 21. 6. Subprogram Section The subprogram section contains all the user- defined functions that are used to perform a specific task. These user-defined functions are called in the main function. User-defined functions are generally placed just after the main() function, although they may appear in any order
  • 22.
  • 23. Identifiers, Identifiers are names for entities in a C program, such as variables, arrays, functions, structures, unions and labels. An identifier can be composed only of uppercase, lowercase letters, underscore and digits, but should start only with an alphabet or an underscore. If the identifier is not used in an external link process, then it is called as internal. Example: Local variable. If the identifier is used in an external link process, then it is called as external. Example: Global variable
  • 24. Rules for constructing identifiers • 1. The first character in an identifier must be an alphabet or an underscore and can be followed only by any number alphabets, or digits or underscores. 2. They must not begin with a digit. 3. Uppercase and lowercase letters are distinct. That is, identifiers are case sensitive. 4. Commas or blank spaces are not allowed within an identifier. 5. Keywords cannot be used as an identifier. 6. Identifiers should not be of length more than 31 characters. 7. Identifiers must be meaningful, short, quickly and easily typed and easily read
  • 25. Valid identifiers: total sum average _x y_ mark_1 x1 Invalid identifiers 1x - begins with a digit char - reserved word x+y - special character
  • 27.
  • 28.
  • 29. What are Data types in C Programming? In C programming, data types are just the same what their name suggests. They represent the kind of data to store. They are used to declare several functions as well as variables in a program
  • 30.
  • 31.
  • 32. C – Constant • C Constants are also like normal variables. But, only difference is, their values can not be modified by the program once they are defined. Constants refer to fixed values. They are also called as literals. Constants may be belonging to any of the data type.
  • 33.
  • 34. Variable in C • C variable is a named location in a memory where a program can manipulate the data. This location is used to hold the value of the variable. • The value of the C variable may get change in the program. • C variable might be belonging to any of the data type like int, float, char etc.
  • 35. Rules for naming C variable: • Variable name must begin with letter or underscore. • Variables are case sensitive • They can be constructed with digits, letters. • No special symbols are allowed other than underscore. • average, height, age, total are some examples for variable name
  • 36. Operators in C Operators are the foundation of any programming language. Thus the functionality of C programming language is incomplete without the use of operators. We can define operators as symbols that help us to perform specific mathematical and logical computations on operands. In other words, we can say that an operator operates the operands
  • 37.
  • 38. 1.Arithmetic Operators An arithmetic operator performs mathematical operations such as addition, subtraction, multiplication, division etc on numerical values
  • 39.
  • 40.
  • 41. • Output • a+b = 13 • a-b = 5 • a*b = 36 • a/b = 2 Remainder when a divided by b=1
  • 42. Bitwise Operator in C • The bitwise operators are the operators used to perform the operations on the data at the bit-level. When we perform the bitwise operations, then it is also known as bit-level programming. • It consists of two digits, either 0 or 1. It is mainly used in numerical computations to make the calculations faster.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47. Relational Operators • These Operators are used to check the relationship between the two operands. If the relation is true, it returns 1; if the relation is false, it returns value 0. Relational operators are used in decision making and loops.
  • 48.
  • 49.
  • 50.
  • 51. 3.logical operators • A logical operator is a symbol or word used to connect two or more expressions such that the value of the compound expression produced depends only on that of the original expressions and on the meaning of the operator. Common logical operators include AND, OR, and NOT.
  • 52.
  • 53. && (LOGICAL AND Operator)
  • 54. Assignment Operators • Assignment operators are used when the value is to be assigned to an identifier, a variable. With execution of assignment operators, value at the right is assigned to the left. The destination variable loses the old value; i.e. old value is over ridden with the new value. If previous value is also required; it should be saved in some other variables.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.