SlideShare a Scribd company logo
1 of 21
R
ENGINEERING COLL
EGE
String in C
DEPARTMENT OF MASTER OF TECHNOLOGY (CSE)
5 YEARS
INTERGRATED
SUBJECT : PROBLEM SOLVING AND C
PROGRAMMING
BY:
MADHUMITHA N.S ES23CJ
22
MAHENDRAN B ES23CJ
23
MANIKANDAN R ES23CJ2
GUIDED BY :
MRS.R.SASIKALA
C O N T E N T S
2
o Introduction
o String Definition And Declaration
o Strings Methods
o Application In Strings
o Question Place
C programming:- Strings
INTRODUCTION
A string is a sequence of characters
It can contain letters, numbers, symbols and even
spaces
It represents within the double quotes (“ “).
It can be in two ways
 Singular line string.
Multipleline string.
4
C programming:- Strings
D E F I N I T I O N O F
S T R I N G :
o A String in C programming is a
sequence of characters
terminated with a null character
'0'.
o The C String is stored as an
array of characters
5
C programming:- Strings
S T R I N G
D E C L A R AT I O N :
o Declaring a string in C is as simple as declaring a one-dimensional array.
o syntax for declaring a string.
char string_name[size];
o In the above syntax string_name is any name given to the string variable and size
is used to define the length of the string, i.e the number of characters strings will
store.
S T R I N G
I N I T I A L I Z AT I O N :
o Assigning a String Literal without Size
o Assigning a String Literal with a Predefined Size
o Assigning Character by Character with Size
o Assigning Character by Character without Size
6
C programming:- Strings
We can initialize a C string in 4 different ways which are as
follows
1 . A S S I G N I N G A
S T R I N G L I T E R A L
W I T H O U T S I Z E
String literals can be assigned without
size. Here, the name of the string str
acts as a pointer because it is an array.
char str[] = "GeeksforGeeks";
C programming:- Strings
2 . A S S I G N I N G A
S T R I N G L I T E R A L
W I T H A P R E D E F I N E D
S I Z E
String literals can be assigned with a
predefined size. But we should always
account for one extra space which will be
assigned to the null character. If we want
to store a string of size n then we should
always declare a string with a size equal to
or greater than n+1.
char str[50] = "GeeksforGeeks";
C programming:- Strings
3 . A S S I N G N I N G
C H A R A C T E R B Y
C H A R A C T E R W I T H
S I Z E
We can also assign a string
character by character. But we
should remember to set the end
character as ‘0’ which is a null
character.
char str[14] = {
'G','e','e','k','s','f','o','r','G','e','e','k','s','
0'};
C programming:- Strings
4 . A S S I G N I N G
C H A R A C T E R B Y
C H A R A C T E R
W I T H O U T S I Z E
We can assign character by character
without size with the NULL character at
the end. The size of the string is
determined by the compiler
automatically.
char str[] = {
'G','e','e','k','s','f','o','r','G','e','e','k','s','
0'};
C programming:- Strings
S T R I N G
M E T H O D S
STRING METHODS:
o strlen()
o strcpy()
o strcat()
o stcmp()
o strrev()
o strlwr()
o strupr()
* It, call string functions
* Header file<string.h> is
included.
C programming:- Strings
11
12
C programming:- Strings
1.str len()
It returns the length of the string.
Eg:
#include <stdio.h>
#include <string.h>
int main() {
char a[10] = "welcome";
int l;
l = strlen(a);
printf (“String - %s",a);
printf(“Length - %d", l);
return 0;
}
Output :
String - Welcome
Length - 7.
13
C programming:- Strings
2.str cpy()
Used to Copy the content from one string to another string
Eg:
#include<stdio.h>
#include<string.h>
int main(){
char a[]="hi";
char b[]="hello";
strcpy(a,b);
printf("a = %s",a);
printf("b =%s",b);
return 0;
}
Output :
a = hello
b= hello
14
C programming:- Strings
3.str cat()
Joins two string
Eg:
#include<stdio.h>
#include<string.h>
int main(){
char a[]="hi";
char b[]="hello";
strcat(a,b);
printf("A = %s",a);
printf("B =%s",b);
return 0;
}
Output :
A = hi hello
B = hello
15
C programming:- Strings
4.str cmp()
It will compare the two strings. If the two string are equal it return o. if the first string
greater than second string it return positive value. if the first string is shorter and the
second string is greater it return negative value.
Eg:
#include<stdio.h>
#include<string.h>
int main(){
char a[]="hi";
char b[]="hello";
int result;
result =strcmp(a,b);
printf(“The result=%s",result);
return 0;
} Output :
The result=-1
a>b -> positive num
a<b -> negative num
a==b -> zero
16
C programming:- Strings
5.str r ev()
It is used to reverse the string
Eg:
#include <stdio.h>
#include <string.h>
int main() {
char a[10] = "welcome";
printf (" the reverse is %s",strrev(a));
return 0;
} Output :
the reverse is
emoclew
17
C programming:- Strings
6.str lwr ()
It returns string characters in lowercase
Eg:
#include <stdio.h>
#include <string.h>
int main() {
char a[10] = "WELCOME";
printf (" The lower is %s",strlwr(a));
return 0;
}
Output :
The lower is
welcome
18
C programming:- Strings
7.str upr ()
It returns string characters in uppercase
Eg:
#include <stdio.h>
#include <string.h>
int main()
{
char a[10] = "welcome";
printf (" The upper is %s",strupr(a));
return 0;
}
Output :
The upper is
WELCOME
A P P L I C AT I O
N O F
S T R I N G
C programming:- Strings
• Input/Output: Displaying and receiving text.
• Manipulation: Concatenation, copying, and
comparison operations.
• Searching : Finding substrings
• File Handling: Reading and writing strings to files.
• Command-Line Arguments: Handling arguments
passed to a C program.
19
QUESTION
PLACE
Any Doubt Ask Freely In Our Team..
20 C programming:- Strings
THANK YOU
Our Team,
MADHUMITHA N.S ES23CJ22
MAHENDRAN B ES23CJ23
MANIKANDAN R ES23CJ24
MENAKA B ES23CJ25

More Related Content

Similar to String in c in erode SENGUNTHAR engineering .pptx

Similar to String in c in erode SENGUNTHAR engineering .pptx (20)

Strings
StringsStrings
Strings
 
String in programming language in c or c++
String in programming language in c or c++String in programming language in c or c++
String in programming language in c or c++
 
CP-STRING (1).ppt
CP-STRING (1).pptCP-STRING (1).ppt
CP-STRING (1).ppt
 
CP-STRING.ppt
CP-STRING.pptCP-STRING.ppt
CP-STRING.ppt
 
CP-STRING.ppt
CP-STRING.pptCP-STRING.ppt
CP-STRING.ppt
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
 
Week6_P_String.pptx
Week6_P_String.pptxWeek6_P_String.pptx
Week6_P_String.pptx
 
Array and string
Array and stringArray and string
Array and string
 
String in c
String in cString in c
String in c
 
Strings IN C
Strings IN CStrings IN C
Strings IN C
 
C string
C stringC string
C string
 
string in C
string in Cstring in C
string in C
 
Strings
StringsStrings
Strings
 
string.ppt
string.pptstring.ppt
string.ppt
 
String (Computer programming and utilization)
String (Computer programming and utilization)String (Computer programming and utilization)
String (Computer programming and utilization)
 
c programming
c programmingc programming
c programming
 
Lesson in Strings for C Programming Lessons
Lesson in Strings for C Programming LessonsLesson in Strings for C Programming Lessons
Lesson in Strings for C Programming Lessons
 
14 strings
14 strings14 strings
14 strings
 
Lecture 05 2017
Lecture 05 2017Lecture 05 2017
Lecture 05 2017
 
CP Handout#8
CP Handout#8CP Handout#8
CP Handout#8
 

Recently uploaded

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
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
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
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
(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
 
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
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
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
 
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
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
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
 
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
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 

Recently uploaded (20)

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
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
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...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
(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
 
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
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
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...
 
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
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
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
 
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
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 

String in c in erode SENGUNTHAR engineering .pptx

  • 1. R ENGINEERING COLL EGE String in C DEPARTMENT OF MASTER OF TECHNOLOGY (CSE) 5 YEARS INTERGRATED SUBJECT : PROBLEM SOLVING AND C PROGRAMMING BY: MADHUMITHA N.S ES23CJ 22 MAHENDRAN B ES23CJ 23 MANIKANDAN R ES23CJ2 GUIDED BY : MRS.R.SASIKALA
  • 2. C O N T E N T S 2 o Introduction o String Definition And Declaration o Strings Methods o Application In Strings o Question Place C programming:- Strings
  • 3. INTRODUCTION A string is a sequence of characters It can contain letters, numbers, symbols and even spaces It represents within the double quotes (“ “). It can be in two ways  Singular line string. Multipleline string.
  • 4. 4 C programming:- Strings D E F I N I T I O N O F S T R I N G : o A String in C programming is a sequence of characters terminated with a null character '0'. o The C String is stored as an array of characters
  • 5. 5 C programming:- Strings S T R I N G D E C L A R AT I O N : o Declaring a string in C is as simple as declaring a one-dimensional array. o syntax for declaring a string. char string_name[size]; o In the above syntax string_name is any name given to the string variable and size is used to define the length of the string, i.e the number of characters strings will store.
  • 6. S T R I N G I N I T I A L I Z AT I O N : o Assigning a String Literal without Size o Assigning a String Literal with a Predefined Size o Assigning Character by Character with Size o Assigning Character by Character without Size 6 C programming:- Strings We can initialize a C string in 4 different ways which are as follows
  • 7. 1 . A S S I G N I N G A S T R I N G L I T E R A L W I T H O U T S I Z E String literals can be assigned without size. Here, the name of the string str acts as a pointer because it is an array. char str[] = "GeeksforGeeks"; C programming:- Strings
  • 8. 2 . A S S I G N I N G A S T R I N G L I T E R A L W I T H A P R E D E F I N E D S I Z E String literals can be assigned with a predefined size. But we should always account for one extra space which will be assigned to the null character. If we want to store a string of size n then we should always declare a string with a size equal to or greater than n+1. char str[50] = "GeeksforGeeks"; C programming:- Strings
  • 9. 3 . A S S I N G N I N G C H A R A C T E R B Y C H A R A C T E R W I T H S I Z E We can also assign a string character by character. But we should remember to set the end character as ‘0’ which is a null character. char str[14] = { 'G','e','e','k','s','f','o','r','G','e','e','k','s',' 0'}; C programming:- Strings
  • 10. 4 . A S S I G N I N G C H A R A C T E R B Y C H A R A C T E R W I T H O U T S I Z E We can assign character by character without size with the NULL character at the end. The size of the string is determined by the compiler automatically. char str[] = { 'G','e','e','k','s','f','o','r','G','e','e','k','s',' 0'}; C programming:- Strings
  • 11. S T R I N G M E T H O D S STRING METHODS: o strlen() o strcpy() o strcat() o stcmp() o strrev() o strlwr() o strupr() * It, call string functions * Header file<string.h> is included. C programming:- Strings 11
  • 12. 12 C programming:- Strings 1.str len() It returns the length of the string. Eg: #include <stdio.h> #include <string.h> int main() { char a[10] = "welcome"; int l; l = strlen(a); printf (“String - %s",a); printf(“Length - %d", l); return 0; } Output : String - Welcome Length - 7.
  • 13. 13 C programming:- Strings 2.str cpy() Used to Copy the content from one string to another string Eg: #include<stdio.h> #include<string.h> int main(){ char a[]="hi"; char b[]="hello"; strcpy(a,b); printf("a = %s",a); printf("b =%s",b); return 0; } Output : a = hello b= hello
  • 14. 14 C programming:- Strings 3.str cat() Joins two string Eg: #include<stdio.h> #include<string.h> int main(){ char a[]="hi"; char b[]="hello"; strcat(a,b); printf("A = %s",a); printf("B =%s",b); return 0; } Output : A = hi hello B = hello
  • 15. 15 C programming:- Strings 4.str cmp() It will compare the two strings. If the two string are equal it return o. if the first string greater than second string it return positive value. if the first string is shorter and the second string is greater it return negative value. Eg: #include<stdio.h> #include<string.h> int main(){ char a[]="hi"; char b[]="hello"; int result; result =strcmp(a,b); printf(“The result=%s",result); return 0; } Output : The result=-1 a>b -> positive num a<b -> negative num a==b -> zero
  • 16. 16 C programming:- Strings 5.str r ev() It is used to reverse the string Eg: #include <stdio.h> #include <string.h> int main() { char a[10] = "welcome"; printf (" the reverse is %s",strrev(a)); return 0; } Output : the reverse is emoclew
  • 17. 17 C programming:- Strings 6.str lwr () It returns string characters in lowercase Eg: #include <stdio.h> #include <string.h> int main() { char a[10] = "WELCOME"; printf (" The lower is %s",strlwr(a)); return 0; } Output : The lower is welcome
  • 18. 18 C programming:- Strings 7.str upr () It returns string characters in uppercase Eg: #include <stdio.h> #include <string.h> int main() { char a[10] = "welcome"; printf (" The upper is %s",strupr(a)); return 0; } Output : The upper is WELCOME
  • 19. A P P L I C AT I O N O F S T R I N G C programming:- Strings • Input/Output: Displaying and receiving text. • Manipulation: Concatenation, copying, and comparison operations. • Searching : Finding substrings • File Handling: Reading and writing strings to files. • Command-Line Arguments: Handling arguments passed to a C program. 19
  • 20. QUESTION PLACE Any Doubt Ask Freely In Our Team.. 20 C programming:- Strings
  • 21. THANK YOU Our Team, MADHUMITHA N.S ES23CJ22 MAHENDRAN B ES23CJ23 MANIKANDAN R ES23CJ24 MENAKA B ES23CJ25