SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Contents:
 What is c language
 History of c language
 Features of C Language
 Describe the C Program
 Input output function:
 Variables in C
 Data types in C language
 Tokens in C
 Keywords in C Language
 C Identifiers
 C Format Specifier
 Operators in C language
 First Program of C Language
 C is mother language of all programming language.
 It is a popular computer programming language.
 It is procedure-oriented programming language.
 It is also called mid level programming language.
 C programming language was developed in 1972 by
Dennis Ritchie at bell laboratories of AT&T(American
Telephone & Telegraph), located in U.S.A.
 Dennis Ritchie is known as founder of c language.
 It was developed to be used in UNIX Operating system.
 It inherits many features of previous languages such as B
and BPCL.
There are many features of c language are given below.
1) Machine Independent or Portable
2) Mid-level programming language
3) structured programming language
4) Rich Library
5) Memory Management
6) Fast Speed
7) Pointers
8) Recursion
9) Extensible
 A variable is a name of the memory location. It is used to store
data. Its value can be changed, and it can be reused many times.
 It is a way to represent memory location through symbol so that
it can be easily identified.
type variable_list;
 int a;
 float b;
 char c;
 A variable can have alphabets, digits,
and underscore.
 A variable name can start with the
alphabet, and underscore only. It can't
start with a digit.
 No whitespace is allowed within the
variable name.
 A variable name must not be any
reserved word or keyword, e.g. int,
float, etc.
Valid variable names:
int a;
int _ab;
int a30;
Invalid variable
names:
int 2;
int a b;
int long;
There are many types of variables in c:
 local variable
 global variable
 static variable
 automatic variable
 external variable
 There are four types of data types in C language.
Types Data Types
Basic Data Type int, char, float, double
Derived Data Type array, pointer, structure, union
Enumeration Data Type enum
Void Data Type void
 Tokens in C is the most important element to be used in creating a
program in C.
 We can define the token as the smallest individual element in C.
Classification of tokens in C
Tokens in C language can be divided into the following categories:
 A keyword is a reserved word. You cannot use it as a
variable name, constant name etc.
 There are 32 keywords in C language as given below:
auto break case char const continue default do
double else enum extern float for goto if
int long register return short signed sizeof static
struct switch typedef union unsigned void volatil
e
while
 C identifiers represent the name in the C program, for example,
variables, functions, arrays, structures, unions, labels, etc.
 An identifier can be composed of letters such as uppercase,
lowercase letters, underscore, digits, but the starting letter should
be either an alphabet or an underscore.
Types of identifiers
 Internal identifier
 External identifier
 Example of valid identifiers
total, sum, average, _m _, sum_1, etc.
 Example of invalid identifiers
2sum (starts with a numerical digit)
int (reserved word)
char (reserved word)
m+n (special character, i.e., '+')
Comments in C language are used to provide information
about lines of code. It is widely used for documenting code.
There are 2 types of comments in the C language.
 Single Line Comments
 Multi-Line Comments
Single Line Comments
#include<stdio.h>
int main(){
//printing information
printf("Hello C");
return 0;
}
Output:
Hello C
Mult Line Comments
#include<stdio.h>
int main(){
/*printing information
Multi-Line Comment*/
printf("Hello C");
return 0;
}
Output:
Hello C
 The Format specifier is a string used in the formatted input
and output functions.
 The format string determines the format of the input and
output.
 The format string always starts with a '%' character.
 An escape sequence in C
language is a sequence of
characters that doesn't represent
itself when used inside string
literal or character.
 It is composed of two or more
characters starting with backslash
. For example: n represents new
line.
List of Escape Sequences in C
Escape Sequence Meaning
a Alarm or Beep
b Backspace
f Form Feed
n New Line
r Carriage Return
t Tab (Horizontal)
v Vertical Tab
 Backslash
' Single Quote
" Double Quote
? Question Mark
nnn octal number
xhh hexadecimal number
0 Null
 A constant is a value or variable that can't be changed in the
program, for example: 10, 20, 'a', 3.4, "c programming" etc.
List of Constants in C
Constant Example
Decimal Constant 10, 20, 450 etc.
Real or Floating-point Constant 10.3, 20.2, 450.6 etc.
Octal Constant 021, 033, 046 etc.
Hexadecimal Constant 0x2a, 0x7b, 0xaa etc.
Character Constant 'a', 'b', 'x' etc.
String Constant "c", "c program", etc.
 There are following types of operators to perform different
types of operations in C language.
1) Arithmetic Operators
2) Relational Operators
3) Special Operators
4) Logical Operators
5) Bitwise Operators
6) Ternary or Conditional Operators
7) Assignment Operator
8) Increment and Decrement Operator
Operator Name Description Example
+ Addition Adds together two values x + y
- Subtraction Subtracts one value from
another
x - y
* Multiplication Multiplies two values x * y
/ Division Divides one value by
another
x / y
% Modulus Returns the division
remainder
x % y
++ Increment Increases the value of a
variable by 1
++x
-- Decrement Decreases the value of a
variable by 1
--x
Operator Name Description Example
&& Logica
l and
Returns true if both
statements are
true
x < 5 && x
< 10
|| Logica
l or
Returns true if one
of the statements
is true
x < 5 || x <
4
! Logica
l not
Reverse the result,
returns false if the
result is true
!(x < 5 && x
< 10)
 Assignment operators are used to assign values to variables.
Operator Example Same As
= x = 5 x = 5
+= x += 3 x = x + 3
-= x -= 3 x = x - 3
*= x *= 3 x = x * 3
/= x /= 3 x = x / 3
%= x %= 3 x = x % 3
&= x &= 3 x = x & 3
|= x |= 3 x = x | 3
^= x ^= 3 x = x ^ 3
>>= x >>= 3 x = x >> 3
<<= x <<= 3 x = x << 3
Relational Operators are the operators used to create a relationship and
compare the values of two operands.
Types of Relational Operators
 Equal To Operator (==)
 Not Equal To Operator (!=)
 Less than Operator (<)
 Greater than Operator (>)
 Less than Equal To Operator (<=)
 Greater than Equal To Operator (>=)
Operators are the predefined symbols of the C/C++ library, and it is used to
perform logical as well as mathematical operations to the operands.
 Pre-increment Operator
 Post increment Operator
 Pre Decrement Operator
 Post decrement Operator
Ternary or Conditional Operators
 The conditional statements are the decision-making statements which
depends upon the output of the expression.
 It is represented by two symbols, i.e., '?' and ':’.
Syntax of a conditional operator
Expression1? expression2: expression3;
The bitwise operators are the operators used to perform the operations on
the data at the bit-level.
Operator Meaning of operator
& Bitwise AND operator
| Bitwise OR operator
^ Bitwise exclusive OR operator
~ One's complement operator
(unary operator)
<< Left shift operator
>> Right shift operator
#include <stdio.h>
#include <conio.h>
void main(){
printf(“Welcome”);
getch();
}
 #include <stdio.h> includes the standard input
output library functions. The printf() function is defined in
stdio.h .
 #include <conio.h> includes the console input
output library functions. The getch() function is defined in
conio.h file.
 void main() The main() function is the entry point of
every program in c language. The void keyword specifies
that it returns no value.
 printf() The printf() function is used to print data on the
console.
 getch() The getch() function asks for a single character.
Until you press any key, it blocks the screen.
There are two input output function of c language.
1) First is printf()
2) Second is scanf()
 printf() function is used for output. It prints the given
statement to the console.
 Syntax of printf() is given below:
 printf(“format string”,arguments_list);
 Format string can be %d(integer), %c(character),
%s(string), %f(float) etc.
 scanf() Function: is used for input. It reads the input data
from console.
 scanf(“format string”,argument_list);
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx

Weitere ähnliche Inhalte

Ähnlich wie C_Programming_Language_tutorial__Autosaved_.pptx

Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to cHattori Sidek
 
Chapter3
Chapter3Chapter3
Chapter3Kamran
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptxmadhurij54
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxKrishanPalSingh39
 
C prog ppt
C prog pptC prog ppt
C prog pptxinoe
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++K Durga Prasad
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubeykiranrajat
 
Fundamentals of c language
Fundamentals of c languageFundamentals of c language
Fundamentals of c languageAkshhayPatel
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)indrasir
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance levelsajjad ali khan
 
C programming language
C programming languageC programming language
C programming languageAbin Rimal
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language Rowank2
 
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 Centrejatin batra
 
Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptxRowank2
 

Ähnlich wie C_Programming_Language_tutorial__Autosaved_.pptx (20)

C program
C programC program
C program
 
C intro
C introC intro
C intro
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
Chapter3
Chapter3Chapter3
Chapter3
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
 
fds unit1.docx
fds unit1.docxfds unit1.docx
fds unit1.docx
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
 
C prog ppt
C prog pptC prog ppt
C prog ppt
 
Introduction to C
Introduction to CIntroduction to C
Introduction to 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++
Getting started with c++
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
 
Fundamentals of c language
Fundamentals of c languageFundamentals of c language
Fundamentals of c language
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 
C programming language
C programming languageC programming language
C programming language
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language
 
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 notes
C notesC notes
C notes
 
Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptx
 

Kürzlich hochgeladen

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 

Kürzlich hochgeladen (20)

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 

C_Programming_Language_tutorial__Autosaved_.pptx

  • 1.
  • 2. Contents:  What is c language  History of c language  Features of C Language  Describe the C Program  Input output function:  Variables in C  Data types in C language  Tokens in C  Keywords in C Language  C Identifiers  C Format Specifier  Operators in C language  First Program of C Language
  • 3.  C is mother language of all programming language.  It is a popular computer programming language.  It is procedure-oriented programming language.  It is also called mid level programming language.
  • 4.  C programming language was developed in 1972 by Dennis Ritchie at bell laboratories of AT&T(American Telephone & Telegraph), located in U.S.A.  Dennis Ritchie is known as founder of c language.  It was developed to be used in UNIX Operating system.  It inherits many features of previous languages such as B and BPCL.
  • 5. There are many features of c language are given below. 1) Machine Independent or Portable 2) Mid-level programming language 3) structured programming language 4) Rich Library 5) Memory Management 6) Fast Speed 7) Pointers 8) Recursion 9) Extensible
  • 6.  A variable is a name of the memory location. It is used to store data. Its value can be changed, and it can be reused many times.  It is a way to represent memory location through symbol so that it can be easily identified. type variable_list;  int a;  float b;  char c;
  • 7.  A variable can have alphabets, digits, and underscore.  A variable name can start with the alphabet, and underscore only. It can't start with a digit.  No whitespace is allowed within the variable name.  A variable name must not be any reserved word or keyword, e.g. int, float, etc. Valid variable names: int a; int _ab; int a30; Invalid variable names: int 2; int a b; int long;
  • 8. There are many types of variables in c:  local variable  global variable  static variable  automatic variable  external variable
  • 9.  There are four types of data types in C language. Types Data Types Basic Data Type int, char, float, double Derived Data Type array, pointer, structure, union Enumeration Data Type enum Void Data Type void
  • 10.  Tokens in C is the most important element to be used in creating a program in C.  We can define the token as the smallest individual element in C. Classification of tokens in C Tokens in C language can be divided into the following categories:
  • 11.  A keyword is a reserved word. You cannot use it as a variable name, constant name etc.  There are 32 keywords in C language as given below: auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatil e while
  • 12.  C identifiers represent the name in the C program, for example, variables, functions, arrays, structures, unions, labels, etc.  An identifier can be composed of letters such as uppercase, lowercase letters, underscore, digits, but the starting letter should be either an alphabet or an underscore. Types of identifiers  Internal identifier  External identifier
  • 13.  Example of valid identifiers total, sum, average, _m _, sum_1, etc.  Example of invalid identifiers 2sum (starts with a numerical digit) int (reserved word) char (reserved word) m+n (special character, i.e., '+')
  • 14. Comments in C language are used to provide information about lines of code. It is widely used for documenting code. There are 2 types of comments in the C language.  Single Line Comments  Multi-Line Comments Single Line Comments #include<stdio.h> int main(){ //printing information printf("Hello C"); return 0; } Output: Hello C Mult Line Comments #include<stdio.h> int main(){ /*printing information Multi-Line Comment*/ printf("Hello C"); return 0; } Output: Hello C
  • 15.  The Format specifier is a string used in the formatted input and output functions.  The format string determines the format of the input and output.  The format string always starts with a '%' character.
  • 16.
  • 17.  An escape sequence in C language is a sequence of characters that doesn't represent itself when used inside string literal or character.  It is composed of two or more characters starting with backslash . For example: n represents new line. List of Escape Sequences in C Escape Sequence Meaning a Alarm or Beep b Backspace f Form Feed n New Line r Carriage Return t Tab (Horizontal) v Vertical Tab Backslash ' Single Quote " Double Quote ? Question Mark nnn octal number xhh hexadecimal number 0 Null
  • 18.  A constant is a value or variable that can't be changed in the program, for example: 10, 20, 'a', 3.4, "c programming" etc. List of Constants in C Constant Example Decimal Constant 10, 20, 450 etc. Real or Floating-point Constant 10.3, 20.2, 450.6 etc. Octal Constant 021, 033, 046 etc. Hexadecimal Constant 0x2a, 0x7b, 0xaa etc. Character Constant 'a', 'b', 'x' etc. String Constant "c", "c program", etc.
  • 19.  There are following types of operators to perform different types of operations in C language. 1) Arithmetic Operators 2) Relational Operators 3) Special Operators 4) Logical Operators 5) Bitwise Operators 6) Ternary or Conditional Operators 7) Assignment Operator 8) Increment and Decrement Operator
  • 20. Operator Name Description Example + Addition Adds together two values x + y - Subtraction Subtracts one value from another x - y * Multiplication Multiplies two values x * y / Division Divides one value by another x / y % Modulus Returns the division remainder x % y ++ Increment Increases the value of a variable by 1 ++x -- Decrement Decreases the value of a variable by 1 --x
  • 21. Operator Name Description Example && Logica l and Returns true if both statements are true x < 5 && x < 10 || Logica l or Returns true if one of the statements is true x < 5 || x < 4 ! Logica l not Reverse the result, returns false if the result is true !(x < 5 && x < 10)
  • 22.  Assignment operators are used to assign values to variables. Operator Example Same As = x = 5 x = 5 += x += 3 x = x + 3 -= x -= 3 x = x - 3 *= x *= 3 x = x * 3 /= x /= 3 x = x / 3 %= x %= 3 x = x % 3 &= x &= 3 x = x & 3 |= x |= 3 x = x | 3 ^= x ^= 3 x = x ^ 3 >>= x >>= 3 x = x >> 3 <<= x <<= 3 x = x << 3
  • 23. Relational Operators are the operators used to create a relationship and compare the values of two operands. Types of Relational Operators  Equal To Operator (==)  Not Equal To Operator (!=)  Less than Operator (<)  Greater than Operator (>)  Less than Equal To Operator (<=)  Greater than Equal To Operator (>=)
  • 24. Operators are the predefined symbols of the C/C++ library, and it is used to perform logical as well as mathematical operations to the operands.  Pre-increment Operator  Post increment Operator  Pre Decrement Operator  Post decrement Operator Ternary or Conditional Operators  The conditional statements are the decision-making statements which depends upon the output of the expression.  It is represented by two symbols, i.e., '?' and ':’. Syntax of a conditional operator Expression1? expression2: expression3;
  • 25. The bitwise operators are the operators used to perform the operations on the data at the bit-level. Operator Meaning of operator & Bitwise AND operator | Bitwise OR operator ^ Bitwise exclusive OR operator ~ One's complement operator (unary operator) << Left shift operator >> Right shift operator
  • 26. #include <stdio.h> #include <conio.h> void main(){ printf(“Welcome”); getch(); }
  • 27.  #include <stdio.h> includes the standard input output library functions. The printf() function is defined in stdio.h .  #include <conio.h> includes the console input output library functions. The getch() function is defined in conio.h file.  void main() The main() function is the entry point of every program in c language. The void keyword specifies that it returns no value.  printf() The printf() function is used to print data on the console.  getch() The getch() function asks for a single character. Until you press any key, it blocks the screen.
  • 28. There are two input output function of c language. 1) First is printf() 2) Second is scanf()  printf() function is used for output. It prints the given statement to the console.  Syntax of printf() is given below:  printf(“format string”,arguments_list);  Format string can be %d(integer), %c(character), %s(string), %f(float) etc.  scanf() Function: is used for input. It reads the input data from console.  scanf(“format string”,argument_list);