SlideShare a Scribd company logo
1 of 75
C PROGRAMING
BY MOHAMMED TAJUDDIN
C PROGRAMMING
• C Keywords and Identifier
• In this chapter you will learn about keywords; reserved words in C
programming that are part of the syntax. Also, you will learn about identifiers
and how to name them.Character set
• A character set is a set of alphabets, letters and some special characters that are
valid in C language.
C PROGRAMMING
• Alphabets
• Uppercase: A B C ................................... X Y Z
• Lowercase: a b c ...................................... x y z
• C accepts both lowercase and uppercase alphabets as variables and
functions.
• Digits
• 0 1 2 3 4 5 6 7 8 9
C PROGRAMMING
• Special Characters
• Special Characters in C Programming
• , < > . _
• ( ) ; $ :
• % [ ] # ?
• ' & { } "
• ^ ! * / |
• -  ~ +
CPROGRAMMING
White space Characters
Blank space, newline, horizontal tab, carriage return and form feed.
C PROGRAMMING
• C Keywords
• Keywords are predefined, reserved words used in programming that
have special meanings to the compiler. Keywords are part of the
syntax and they cannot be used as an identifier. For example:
Ex : int money;
C PROGRAMING
• Here, int is a keyword that indicates money is a variable of type int
(integer).
• As C is a case sensitive language, all keywords must be written in
lowercase. Here is a list of all keywords allowed in ANSI C.
C PROGRAMMING
• C Keywords
• auto doubleint struct
• break else long switch
• case enum register typedef
• char extern return union
• continue for signed void
• do if static while
• default goto sizeof volatile
• const float short unsigned
C PROGRAMMING
• C Identifiers
• Identifier refers to name given to entities such as variables, functions,
structures etc.
• Identifiers must be unique. They are created to give a unique name to
an entity to identify it during the execution of the program. For
example:
• int money;
• double accountBalance;
C PROGRAMMING
• Here, money and accountBalance are identifiers.
• Also remember, identifier names must be different from keywords.
You cannot use int as an identifier because int is a keyword.
C PROGRAMMING
• Rules for naming identifiers
• A valid identifier can have letters (both uppercase and lowercase
letters), digits and underscores.
• The first letter of an identifier should be either a letter or an
underscore.
• You cannot use keywords like int, while etc. as identifiers.
• There is no rule on how long an identifier can be. However, you may
run into problems in some compilers if the identifier is longer than 31
characters.
• You can choose any name as an identifier if you follow the above rule,
however, give meaningful names to identifiers that make sense.
C PROGAMMING
Data Types in C
A data type specifies the type of data that a variable can store such as
integer, floating, character, etc.
c data types :
Primary or Basic datatype
Derived datatype
Enumeration datatype
void dataype
C PROGAMMING
• There are the following data types in C language.
• Basic Data Type : int, char, float, double
• Derived Data Type :array, pointer, structure, union
• Enumeration Data Type : enum
• Void Data Type : void
• Basic Data Types
• The basic data types are integer-based and floating-point based. C language
supports both signed and unsigned literals.
• The memory size of the basic data types may change according to 32 or 64-bit
operating system.
C PROGAMMING
• Let's see the basic data types. Its size is given according to 32-bit
architecture.
• Data Types Memory SizeRange
• char 1 byte −128 to 127
• signed char 1 byte −128 to 127
• unsigned char 1 byte 0 to 255
• short 2 byte −32,768 to 32,767
• signed short 2 byte −32,768 to 32,767
C PROGRAMMING
• int 2 byte −32,768 to 32,767
• signed int 2 byte −32,768 to 32,767
• unsigned int 2 byte 0 to 65,535
• short int 2 byte −32,768 to 32,767
• signed short int 2 byte −32,768 to 32,767
• unsigned short int 2 byte 0 to 65,535
• long int 4 byt -2,147,483,648 to 2,147,483,647
• signed long int 4 byte -2,147,483,648 to 2,147,483,647
• unsigned long int 4 byte 0 to 4,294,967,295
C PROGAMMING
• float 4 byte
• double 8 byte
• long double 10 byte
C PROGRAMING
• Variables in C
• 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.
• Let's see the syntax to declare a variable:
• type variable_list;
C PROGAMMING
• Rules for defining variables
• 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.
C PROGRAMMING
• Valid variable names:
• int a;
• int _ab;
• int a30;
• Invalid variable names:
• int 2;
• int a b;
• int long;
C PROGRAMMING
• Types of Variables i of variables in c:
• local variable
• global variablen C
• static variable
• automatic variable
• external variable
C PROGRAMMING
• Local Variable
• A variable that is declared inside the function or block is called a local
variable.
• It must be declared at the start of the block.
• void function1(){
• int x=10;//local variable
• }
• You must have to initialize the local variable before it is used.
C PROGRAMMING
• Global Variable
• A variable that is declared outside the function or block is called a global
variable. Any function can change the value of the global variable. It is
available to all the functions.
• It must be declared at the start of the block.
• int value=20;//global variable
• void function1(){
• int x=10;//local variable
• }
C PROGRAMMING
• Static Variable
• A variable that is declared with the static keyword is called static variable.
• It retains its value between multiple function calls.
• void function1(){
• int x=10;//local variable
• static int y=10;//static variable
• x=x+1;
• y=y+1;
• printf("%d,%d",x,y);
• }
C PROGRAMMING
• If you call this function many times, the local variable will print the
• same value for each function call, e.g, 11,11,11 and so on. But the
• static variable will print the incremented value in each function call,
• e.g. 11, 12, 13 and so on.
C PROGRAMMING
• Automatic Variable
• All variables in C that are declared inside the block, are automatic
variables by default. We can explicitly declare an automatic variable
using auto keyword.
• void main(){
• int x=10;//local variable (also automatic)
• auto int y=20;//automatic variable
• }
C PROGRAMMING
• External Variable
• We can share a variable in multiple C source files by using an external
variable. To declare an external variable, you need to use extern
keyword.
C PROGRAMMING
• extern int x=10;//external variable (also global)
• program1.c
• #include "myfile.h"
• #include <stdio.h>
• void printValue(){
• printf("Global variable: %d", global_variable);
• }
C PROGRAMMING
• The format specifiers :
• These are used in C for input and output purposes. Using this concept
• the compiler can understand that what type of data is in a variable
• during taking input using the scanf() function and printing using
• printf() function. Here is a list of format specifiers
C PROGRAMMING
• Format Specifier Type
• %c Character
• %d Signed integer
• %e or %E Scientific notation of floats
• %f Float values
• %g or %G Similar as %e or %E
• %hi Signed integer (short)
• %hu Unsigned Integer (short)
• %i Unsigned integer
• %l or %ld or %li Long
C PROGRAMMING
%lf Double
%Lf Long double
%lu Unsigned int or unsigned long
%lli or %lld Long long
%llu Unsigned long long
%o Octal representation
%p Pointer
%s String
%u Unsigned int
%x or %X Hexadecimal representation
%n Prints nothing
%% Prints % character
• #include <stdio.h>
• main() {
• char ch = 'B';
• printf("%cn", ch); //printing character data
• //print decimal or integer data with d and i
• int x = 45, y = 90;
• printf("%dn", x);
• printf("%in", y);
C PROGRAMMING
• float f = 12.67;
• printf("%fn", f); //print float value
• printf("%en", f); //print in scientific notation
• int a = 67;
• printf("%on", a); //print in octal format
• printf("%xn", a); //print in hex format
C PROGRAMMING
• char str[] = "Hello World";
• printf("%sn", str);
• printf("%20sn", str); //shift to the right 20 characters including the
string
• printf("%-20sn", str); //left align
• printf("%20.5sn", str); //shift to the right 20 characters including
the string, and print string up to 5 character
• printf("%-20.5sn", str); //left align and print string up to 5 character
C PROGRAMMING
• constants :
• Fixed value whose value cannot be changed entire execution of
programe.
• Integer constants :
• Decimal
• octal
• Hexa decimal
C PROGRAMMING
Floating point constants
Charecter constants
constants with in single cotations
Ex : ‘1’ , ‘A’ both uppercase and lowercase
C PROGRAMMING
• String constants
• collection of charectres with in double cotations .
• Ex : “robo”, “12345”
C PROGRAMMING
• Pre processor directive constants :
• it is not a part of compiler
• it is the process before compilation done by prprocessor ‘#’
• it is text substitution tool
C PROGRAMMING
• #define A 10
• int main()
• {
• int a= A;
• printf(“%d”,a);
• }
• A is macro name best is to write in capital letters
C PROGRAMMING
#define MUL(a,b) a*b
int main()
{
int a=2;
int b=3;
printf(“%d”,MUL(a,b));
}
• it work as a function
C PROGRAMMING
#define MAX(a,b) if(a>b)
printf(“%d is max”,a);
else
printf(“%d is max”,b);
printf(“%d”,MAX(5,6));
}
• #undef is for undefine macro Ex : #undef MAX
C PROGRAMMING
• Operators in c
• Types of operators based on operands
• 1)Unary
• 2)Binary
• 3)Ternary
• one operand is there in unary operators
• Two operands are there in binary operators
• Three operands are there in ternary operators
C PROGRAMMING
• Unary operators :
• ‘-’ minus operator
• ‘++’ incriment operator
• 1)pre incriment operator
• 2)post incriment operator
• ‘--’ dicriment operator
• 1)pre dicriment operator
• 2)post dicriment operator
C PROGRAMMING
• ‘&’ address operator
• size of operator
• ‘-’ operator
• Ex : int main()
• {
• int a=10,b=5;
• c=a+(-b);}
• 10+(-5)=5
C PROGRAMMING
• ‘++’ incriment operator
• Ex : (post incriment)
int main(){
int x=10,y=11;
y=x++;
printf(“%d”,y);
printf(“%d”,x);
} //o/p : 10,11
C PROGRAMMING
• Ex : pre incriment operator :
int main(){
int a=10,b=11;
b=++a;
printf(“%d”,b);
printf(“%d”,a);
}
o/p : 11,11 //same as pre and post dicriment operator
C PROGRAMMING
• ‘!’ logical not operator
• true value as false and false value is true
C PROGRAMMING
• Binary operators : (it has two operands)
• 1)Arithmetic (+, -, /, *, %)
• 2)Relational (<, >, <=, >=)
• 3)Logical (&&(AND), II(OR))
• 4)Bit wise(&, I, <<, >>, ^ (XOR), ~(bit wise nagation))
• 5)Equality (==, !=)
• 6)Comma
• 7)Assignment
C PROGRAMMING
• Ternary operator : (it require 3 operands)
• rules for ternary operator
• (condition)expressin1?expression2:expression3
• if condition is true expression 2 executed if not expression 3
executed
Ex : int a=10,b=11;
x=(a>b)?a:b//o/p 11
it is same as if -else statement
C PROGRAMMING
• Arithmetic operators : Example:
int mai(){
int a=10,b=11;
c=a+b;
printf(“%d”,c)
c=a-b,a*b,a/b,a%b;
printf(“%d%d%d%d”,c)
}
C PROGRAMMING
• ‘=’ Assignment operator : Example :
rule : left side should be variable
a=b=c=d=10;
a+=1 (a=a+1)
a-=1 (a=a-1)
C PROGRAMMING
• Relational operators :
• it is used to comparision between two variables
and it will give result either 1 or 0
means true or false.
symbols : < , > , <= , >= , == , !=
C PROGRAMMING
• Logical operators :
To compare 3 variables
symbols :
&& , || ,!
&& true true true, || true false true,
! false false true
C PROGRAMMING
• Dicission Control statements or
Conditional statements or Branching statements
they are
simple if , if - else , else - if ladder , nested if
switch statements
C PROGRAMMING
in conditional statements relational operators and logicl operators
play key role.
xample for simple if :
int a=0, b=5;
if(a<b)
{
printf(“a is small”);
}
C PROGRAMMING
• Example for if-else :
int main(){
int a=10,b=11;
printf(“show the result”);
if(a>b){
printf(“%d”,a);
else{
printf(“%d”,b);}}}
C PROGRAMMING
• if-else syntax :
if(condition)
{
true statement
}
else
{
false statement}
C PROGRAMMING
• else-if syntax :
if(condition){
true statement}
else if(condition){
true statement}
else{
false statement
}
C PROGRAMMING
Example for ef-else ladder :
int x,y;
printf(“enter numbers”);
scanf(“%d%d”,&x,&y);
if(x>y){
printf(“ x is big”);}
else if(x<y){
printf(“y is small”);}
else{
printf(“both are same”);}
C PROGRAMMING
• Nested if statement sytax :
if(condition)
{
if(condition)
{
}
else
}
Example for nested if statement :
int x,y,z;
printf(“enter numbers”);
scanf(“%d%d%d”,&x,&y,&z);
if(x>y){
if(x>z){
printf(“x is big”);
}
C PROGRAMMING
else{
printf(“z is big”);
}
else{
if(y>z){
printf(“y is big”);}
else{
printf(“z isbig”);}
C PROGRAMMING
• Example for logical && operator :
int a=10,b=20,c=30;
if(a>b)&&(a>c){
printf(“a is large”);}
else if(b>a)&&(b>c){
printf(“b is large”);}
else{
printf(“c is large”);}
C PROGRAMMING
Switch statement :
switch allows expression to have integerbased evaluation while if
statements allows both integer and charecter based evaluations.
switch is multiple multyway decision making statement.
C PROGRAMMING
• syntax :
switch(condition/expression/constant value){
case lable1: statement;
break;
case labe2 : statement;
break;
default : statement;
break;}
C PROGRAMMING
int ch;
printf(“who is favorite hero”);
scanf(“%d”,&ch);
switch(ch){
case 1: printf(“nani”);
break;
case 2: printf(“mahesh babu”);
break;
default: printf(“invalid case”);
break;
}}
C PROGRAMMING
• Bit wise operators :
Bitwise operators are used to perform operations in bits.bitwise
operators works on binary numbers.
& bitwise AND
| bitwise OR
^ bitwise Ex-OR
~ compliment
<< left shift operator
>> right shift operator
C PROGRAMMING
Bitwise AND( & ) :
Example : a&b
a=101 ; b=110
1 0 1 Truth table(AND)
1 1 0
1 0 0 0 0 0
0 1 0
1 0 0
1 1 1
0=false ; 1=true
C PROGRAMMING
Bitwise ‘|’ (OR) : Truth Table
Example : a | b 0 0 0
a = 101 ; b = 110 0 1 1
1 0 1 1 0 1
1 1 0 1 1 1
1 1 1 1= true ; 0 = false
• Exclusive OR ‘^’ (or) Bitwise X - OR : Truth Table
a ^ b 0 0 0
a = 101 ; b = 110 0 1 1
1 0 1 1 0 1
1 1 0 1 1 0
0 1 1
C PROGRAMMING
Compliment ‘~’ :
a = 101
~a=010
Left shift operator ‘<<’ :
a = 10<<2
0101 ‘<<’ 0101
Right shift operator ‘>>’ :
a = 10 ‘>>’ 2
0101 ‘>>’ 0010

More Related Content

Similar to C PROGRAMING.pptx

programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.pptFatimaZafar68
 
Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2Dhiviya Rose
 
Data structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in CData structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in Cbabuk110
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxLECO9
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxSKUP1
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxMamataAnilgod
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingEric Chou
 
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
 
C PROGRAMMING LANGUAGE.pptx
 C PROGRAMMING LANGUAGE.pptx C PROGRAMMING LANGUAGE.pptx
C PROGRAMMING LANGUAGE.pptxAnshSrivastava48
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt8759000398
 
C Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptxC Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptxMurali M
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageZubayer Farazi
 
Cse115 lecture04introtoc programming
Cse115 lecture04introtoc programmingCse115 lecture04introtoc programming
Cse115 lecture04introtoc programmingMd. Ashikur Rahman
 

Similar to C PROGRAMING.pptx (20)

C language
C languageC language
C language
 
programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.ppt
 
Lec-1c.pdf
Lec-1c.pdfLec-1c.pdf
Lec-1c.pdf
 
Cpu
CpuCpu
Cpu
 
Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2
 
Data structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in CData structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in C
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptx
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary Programming
 
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
 
C for Engineers
C for EngineersC for Engineers
C for Engineers
 
C introduction by thooyavan
C introduction by  thooyavanC introduction by  thooyavan
C introduction by thooyavan
 
C
CC
C
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
C PROGRAMMING LANGUAGE.pptx
 C PROGRAMMING LANGUAGE.pptx C PROGRAMMING LANGUAGE.pptx
C PROGRAMMING LANGUAGE.pptx
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
C Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptxC Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptx
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming Language
 
Cse115 lecture04introtoc programming
Cse115 lecture04introtoc programmingCse115 lecture04introtoc programming
Cse115 lecture04introtoc programming
 

More from MohammedtajuddinTaju (12)

EMBEDDED SYSTEM AUTOSAR.pdf
EMBEDDED SYSTEM AUTOSAR.pdfEMBEDDED SYSTEM AUTOSAR.pdf
EMBEDDED SYSTEM AUTOSAR.pdf
 
numbers_systems.pptx
numbers_systems.pptxnumbers_systems.pptx
numbers_systems.pptx
 
POINTERS.pptx
POINTERS.pptxPOINTERS.pptx
POINTERS.pptx
 
Nested and Infinite loops.pptx
Nested and Infinite loops.pptxNested and Infinite loops.pptx
Nested and Infinite loops.pptx
 
LOOPS IN C.pptx
LOOPS IN C.pptxLOOPS IN C.pptx
LOOPS IN C.pptx
 
FUNCTIONS1.pptx
FUNCTIONS1.pptxFUNCTIONS1.pptx
FUNCTIONS1.pptx
 
FUNCTIONS.pptx
FUNCTIONS.pptxFUNCTIONS.pptx
FUNCTIONS.pptx
 
ARRAYS.pptx
ARRAYS.pptxARRAYS.pptx
ARRAYS.pptx
 
ARRAYS1.pptx
ARRAYS1.pptxARRAYS1.pptx
ARRAYS1.pptx
 
DMA.pptx
DMA.pptxDMA.pptx
DMA.pptx
 
INTRODUCTION TO C LANGUAGE.pptx
INTRODUCTION TO C LANGUAGE.pptxINTRODUCTION TO C LANGUAGE.pptx
INTRODUCTION TO C LANGUAGE.pptx
 
EMBEDDED SYSTEMS INTRODUCTION.pptx
EMBEDDED SYSTEMS INTRODUCTION.pptxEMBEDDED SYSTEMS INTRODUCTION.pptx
EMBEDDED SYSTEMS INTRODUCTION.pptx
 

Recently uploaded

Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
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
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
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
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
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
 
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
 
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
 
(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
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
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
 
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
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 

Recently uploaded (20)

★ 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
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
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
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
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
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
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
 
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
 
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
 
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...
 
(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...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
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
 
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
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 

C PROGRAMING.pptx

  • 2. C PROGRAMMING • C Keywords and Identifier • In this chapter you will learn about keywords; reserved words in C programming that are part of the syntax. Also, you will learn about identifiers and how to name them.Character set • A character set is a set of alphabets, letters and some special characters that are valid in C language.
  • 3. C PROGRAMMING • Alphabets • Uppercase: A B C ................................... X Y Z • Lowercase: a b c ...................................... x y z • C accepts both lowercase and uppercase alphabets as variables and functions. • Digits • 0 1 2 3 4 5 6 7 8 9
  • 4. C PROGRAMMING • Special Characters • Special Characters in C Programming • , < > . _ • ( ) ; $ : • % [ ] # ? • ' & { } " • ^ ! * / | • - ~ +
  • 5. CPROGRAMMING White space Characters Blank space, newline, horizontal tab, carriage return and form feed.
  • 6. C PROGRAMMING • C Keywords • Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier. For example: Ex : int money;
  • 7. C PROGRAMING • Here, int is a keyword that indicates money is a variable of type int (integer). • As C is a case sensitive language, all keywords must be written in lowercase. Here is a list of all keywords allowed in ANSI C.
  • 8. C PROGRAMMING • C Keywords • auto doubleint struct • break else long switch • case enum register typedef • char extern return union • continue for signed void • do if static while • default goto sizeof volatile • const float short unsigned
  • 9. C PROGRAMMING • C Identifiers • Identifier refers to name given to entities such as variables, functions, structures etc. • Identifiers must be unique. They are created to give a unique name to an entity to identify it during the execution of the program. For example: • int money; • double accountBalance;
  • 10. C PROGRAMMING • Here, money and accountBalance are identifiers. • Also remember, identifier names must be different from keywords. You cannot use int as an identifier because int is a keyword.
  • 11. C PROGRAMMING • Rules for naming identifiers • A valid identifier can have letters (both uppercase and lowercase letters), digits and underscores. • The first letter of an identifier should be either a letter or an underscore. • You cannot use keywords like int, while etc. as identifiers. • There is no rule on how long an identifier can be. However, you may run into problems in some compilers if the identifier is longer than 31 characters. • You can choose any name as an identifier if you follow the above rule, however, give meaningful names to identifiers that make sense.
  • 12. C PROGAMMING Data Types in C A data type specifies the type of data that a variable can store such as integer, floating, character, etc. c data types : Primary or Basic datatype Derived datatype Enumeration datatype void dataype
  • 13.
  • 14. C PROGAMMING • There are the following data types in C language. • Basic Data Type : int, char, float, double • Derived Data Type :array, pointer, structure, union • Enumeration Data Type : enum • Void Data Type : void • Basic Data Types • The basic data types are integer-based and floating-point based. C language supports both signed and unsigned literals. • The memory size of the basic data types may change according to 32 or 64-bit operating system.
  • 15. C PROGAMMING • Let's see the basic data types. Its size is given according to 32-bit architecture. • Data Types Memory SizeRange • char 1 byte −128 to 127 • signed char 1 byte −128 to 127 • unsigned char 1 byte 0 to 255 • short 2 byte −32,768 to 32,767 • signed short 2 byte −32,768 to 32,767
  • 16. C PROGRAMMING • int 2 byte −32,768 to 32,767 • signed int 2 byte −32,768 to 32,767 • unsigned int 2 byte 0 to 65,535 • short int 2 byte −32,768 to 32,767 • signed short int 2 byte −32,768 to 32,767 • unsigned short int 2 byte 0 to 65,535 • long int 4 byt -2,147,483,648 to 2,147,483,647 • signed long int 4 byte -2,147,483,648 to 2,147,483,647 • unsigned long int 4 byte 0 to 4,294,967,295
  • 17. C PROGAMMING • float 4 byte • double 8 byte • long double 10 byte
  • 18. C PROGRAMING • Variables in C • 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. • Let's see the syntax to declare a variable: • type variable_list;
  • 19. C PROGAMMING • Rules for defining variables • 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.
  • 20. C PROGRAMMING • Valid variable names: • int a; • int _ab; • int a30; • Invalid variable names: • int 2; • int a b; • int long;
  • 21. C PROGRAMMING • Types of Variables i of variables in c: • local variable • global variablen C • static variable • automatic variable • external variable
  • 22. C PROGRAMMING • Local Variable • A variable that is declared inside the function or block is called a local variable. • It must be declared at the start of the block. • void function1(){ • int x=10;//local variable • } • You must have to initialize the local variable before it is used.
  • 23. C PROGRAMMING • Global Variable • A variable that is declared outside the function or block is called a global variable. Any function can change the value of the global variable. It is available to all the functions. • It must be declared at the start of the block. • int value=20;//global variable • void function1(){ • int x=10;//local variable • }
  • 24. C PROGRAMMING • Static Variable • A variable that is declared with the static keyword is called static variable. • It retains its value between multiple function calls. • void function1(){ • int x=10;//local variable • static int y=10;//static variable • x=x+1; • y=y+1; • printf("%d,%d",x,y); • }
  • 25. C PROGRAMMING • If you call this function many times, the local variable will print the • same value for each function call, e.g, 11,11,11 and so on. But the • static variable will print the incremented value in each function call, • e.g. 11, 12, 13 and so on.
  • 26. C PROGRAMMING • Automatic Variable • All variables in C that are declared inside the block, are automatic variables by default. We can explicitly declare an automatic variable using auto keyword. • void main(){ • int x=10;//local variable (also automatic) • auto int y=20;//automatic variable • }
  • 27. C PROGRAMMING • External Variable • We can share a variable in multiple C source files by using an external variable. To declare an external variable, you need to use extern keyword.
  • 28. C PROGRAMMING • extern int x=10;//external variable (also global) • program1.c • #include "myfile.h" • #include <stdio.h> • void printValue(){ • printf("Global variable: %d", global_variable); • }
  • 29.
  • 30.
  • 31. C PROGRAMMING • The format specifiers : • These are used in C for input and output purposes. Using this concept • the compiler can understand that what type of data is in a variable • during taking input using the scanf() function and printing using • printf() function. Here is a list of format specifiers
  • 32. C PROGRAMMING • Format Specifier Type • %c Character • %d Signed integer • %e or %E Scientific notation of floats • %f Float values • %g or %G Similar as %e or %E • %hi Signed integer (short) • %hu Unsigned Integer (short) • %i Unsigned integer • %l or %ld or %li Long
  • 33. C PROGRAMMING %lf Double %Lf Long double %lu Unsigned int or unsigned long %lli or %lld Long long %llu Unsigned long long %o Octal representation %p Pointer %s String %u Unsigned int %x or %X Hexadecimal representation %n Prints nothing %% Prints % character
  • 34. • #include <stdio.h> • main() { • char ch = 'B'; • printf("%cn", ch); //printing character data • //print decimal or integer data with d and i • int x = 45, y = 90; • printf("%dn", x); • printf("%in", y);
  • 35. C PROGRAMMING • float f = 12.67; • printf("%fn", f); //print float value • printf("%en", f); //print in scientific notation • int a = 67; • printf("%on", a); //print in octal format • printf("%xn", a); //print in hex format
  • 36. C PROGRAMMING • char str[] = "Hello World"; • printf("%sn", str); • printf("%20sn", str); //shift to the right 20 characters including the string • printf("%-20sn", str); //left align • printf("%20.5sn", str); //shift to the right 20 characters including the string, and print string up to 5 character • printf("%-20.5sn", str); //left align and print string up to 5 character
  • 37. C PROGRAMMING • constants : • Fixed value whose value cannot be changed entire execution of programe. • Integer constants : • Decimal • octal • Hexa decimal
  • 38. C PROGRAMMING Floating point constants Charecter constants constants with in single cotations Ex : ‘1’ , ‘A’ both uppercase and lowercase
  • 39. C PROGRAMMING • String constants • collection of charectres with in double cotations . • Ex : “robo”, “12345”
  • 40. C PROGRAMMING • Pre processor directive constants : • it is not a part of compiler • it is the process before compilation done by prprocessor ‘#’ • it is text substitution tool
  • 41. C PROGRAMMING • #define A 10 • int main() • { • int a= A; • printf(“%d”,a); • } • A is macro name best is to write in capital letters
  • 42. C PROGRAMMING #define MUL(a,b) a*b int main() { int a=2; int b=3; printf(“%d”,MUL(a,b)); } • it work as a function
  • 43. C PROGRAMMING #define MAX(a,b) if(a>b) printf(“%d is max”,a); else printf(“%d is max”,b); printf(“%d”,MAX(5,6)); } • #undef is for undefine macro Ex : #undef MAX
  • 44. C PROGRAMMING • Operators in c • Types of operators based on operands • 1)Unary • 2)Binary • 3)Ternary • one operand is there in unary operators • Two operands are there in binary operators • Three operands are there in ternary operators
  • 45. C PROGRAMMING • Unary operators : • ‘-’ minus operator • ‘++’ incriment operator • 1)pre incriment operator • 2)post incriment operator • ‘--’ dicriment operator • 1)pre dicriment operator • 2)post dicriment operator
  • 46. C PROGRAMMING • ‘&’ address operator • size of operator • ‘-’ operator • Ex : int main() • { • int a=10,b=5; • c=a+(-b);} • 10+(-5)=5
  • 47. C PROGRAMMING • ‘++’ incriment operator • Ex : (post incriment) int main(){ int x=10,y=11; y=x++; printf(“%d”,y); printf(“%d”,x); } //o/p : 10,11
  • 48. C PROGRAMMING • Ex : pre incriment operator : int main(){ int a=10,b=11; b=++a; printf(“%d”,b); printf(“%d”,a); } o/p : 11,11 //same as pre and post dicriment operator
  • 49. C PROGRAMMING • ‘!’ logical not operator • true value as false and false value is true
  • 50. C PROGRAMMING • Binary operators : (it has two operands) • 1)Arithmetic (+, -, /, *, %) • 2)Relational (<, >, <=, >=) • 3)Logical (&&(AND), II(OR)) • 4)Bit wise(&, I, <<, >>, ^ (XOR), ~(bit wise nagation)) • 5)Equality (==, !=) • 6)Comma • 7)Assignment
  • 51. C PROGRAMMING • Ternary operator : (it require 3 operands) • rules for ternary operator • (condition)expressin1?expression2:expression3 • if condition is true expression 2 executed if not expression 3 executed Ex : int a=10,b=11; x=(a>b)?a:b//o/p 11 it is same as if -else statement
  • 52. C PROGRAMMING • Arithmetic operators : Example: int mai(){ int a=10,b=11; c=a+b; printf(“%d”,c) c=a-b,a*b,a/b,a%b; printf(“%d%d%d%d”,c) }
  • 53.
  • 54. C PROGRAMMING • ‘=’ Assignment operator : Example : rule : left side should be variable a=b=c=d=10; a+=1 (a=a+1) a-=1 (a=a-1)
  • 55. C PROGRAMMING • Relational operators : • it is used to comparision between two variables and it will give result either 1 or 0 means true or false. symbols : < , > , <= , >= , == , !=
  • 56.
  • 57. C PROGRAMMING • Logical operators : To compare 3 variables symbols : && , || ,! && true true true, || true false true, ! false false true
  • 58. C PROGRAMMING • Dicission Control statements or Conditional statements or Branching statements they are simple if , if - else , else - if ladder , nested if switch statements
  • 59. C PROGRAMMING in conditional statements relational operators and logicl operators play key role. xample for simple if : int a=0, b=5; if(a<b) { printf(“a is small”); }
  • 60. C PROGRAMMING • Example for if-else : int main(){ int a=10,b=11; printf(“show the result”); if(a>b){ printf(“%d”,a); else{ printf(“%d”,b);}}}
  • 61. C PROGRAMMING • if-else syntax : if(condition) { true statement } else { false statement}
  • 62. C PROGRAMMING • else-if syntax : if(condition){ true statement} else if(condition){ true statement} else{ false statement }
  • 63. C PROGRAMMING Example for ef-else ladder : int x,y; printf(“enter numbers”); scanf(“%d%d”,&x,&y); if(x>y){ printf(“ x is big”);} else if(x<y){ printf(“y is small”);} else{ printf(“both are same”);}
  • 64. C PROGRAMMING • Nested if statement sytax : if(condition) { if(condition) { } else }
  • 65. Example for nested if statement : int x,y,z; printf(“enter numbers”); scanf(“%d%d%d”,&x,&y,&z); if(x>y){ if(x>z){ printf(“x is big”); }
  • 66. C PROGRAMMING else{ printf(“z is big”); } else{ if(y>z){ printf(“y is big”);} else{ printf(“z isbig”);}
  • 67. C PROGRAMMING • Example for logical && operator : int a=10,b=20,c=30; if(a>b)&&(a>c){ printf(“a is large”);} else if(b>a)&&(b>c){ printf(“b is large”);} else{ printf(“c is large”);}
  • 68. C PROGRAMMING Switch statement : switch allows expression to have integerbased evaluation while if statements allows both integer and charecter based evaluations. switch is multiple multyway decision making statement.
  • 69. C PROGRAMMING • syntax : switch(condition/expression/constant value){ case lable1: statement; break; case labe2 : statement; break; default : statement; break;}
  • 70. C PROGRAMMING int ch; printf(“who is favorite hero”); scanf(“%d”,&ch); switch(ch){ case 1: printf(“nani”); break; case 2: printf(“mahesh babu”); break; default: printf(“invalid case”); break; }}
  • 71. C PROGRAMMING • Bit wise operators : Bitwise operators are used to perform operations in bits.bitwise operators works on binary numbers. & bitwise AND | bitwise OR ^ bitwise Ex-OR ~ compliment << left shift operator >> right shift operator
  • 72. C PROGRAMMING Bitwise AND( & ) : Example : a&b a=101 ; b=110 1 0 1 Truth table(AND) 1 1 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1 1 0=false ; 1=true
  • 73. C PROGRAMMING Bitwise ‘|’ (OR) : Truth Table Example : a | b 0 0 0 a = 101 ; b = 110 0 1 1 1 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1= true ; 0 = false
  • 74. • Exclusive OR ‘^’ (or) Bitwise X - OR : Truth Table a ^ b 0 0 0 a = 101 ; b = 110 0 1 1 1 0 1 1 0 1 1 1 0 1 1 0 0 1 1
  • 75. C PROGRAMMING Compliment ‘~’ : a = 101 ~a=010 Left shift operator ‘<<’ : a = 10<<2 0101 ‘<<’ 0101 Right shift operator ‘>>’ : a = 10 ‘>>’ 2 0101 ‘>>’ 0010