SlideShare a Scribd company logo
1 of 30
IMPLEMENTATION OF
STRING FUNCTIONS
Hello!
I Am Fazila Sadia
Roll No. : BM -014
What Are
Strings
“Strings are actually array of
characters terminated by a null
character.Each character occupies one
byte of memory.
String Functions
The prototypes of string functions
can be found in string.h file.The
following is a list of functions found
within the <string.h> header file:
strlen( )
name_variable=strlen(string_name);
Function strlen( ) returns value of type integer
Synatax Of strlen( ) :
Example
Without Using Built In Function
String Concatenation
String concatenation is the operation of
joining character strings end-to-end. For
example, the concatenation of "snow" and
"ball" is "snowball. For two sets of strings S1
and S2, the concatenation S1S2 consists of
all strings of the form vw where v is a string
from S1 and w is a string from S2 .
strcpy( )
Syntax Of strcpy
strcpy(dest,source);
Here, source and destination are
both the name of the string. This
statement, copies the content of
string source to the content of
string destination.
Example
If destination string length is less than source string, entire
source string value won’t be copied into destination string.
For example, consider destination string length is 20 and
source string length is 30.
If you want to copy 25 characters from source string using
strncpy( ) function, only 20 characters from source string
will be copied into destination string and remaining 5
characters won’t be copied and will be truncated.
strncpy( )
strncpy(dest,source,size of)
Syntax Of strcpy( ):
Syntax Of strcmp( )
int strcmp (str_1,str_2);
strcmp is case sensitive, i.e "a" and "A" are
treated as different characters
strncmp( )
Syntax Of strncmp( )
int strncmp(dest,source,size_t);
The strncmp function returns a negative, zero, or
positive integer depending on whether the first n
characters of the object pointed to by s1 are less
than, equal to, or greater than the first n characters of
the object pointed to by s2.
The strncmp function will stop comparing if a null
character is encountered in either s1 or s2
strcmpi( )
Syntax Of strcmpi
This function is not case i.e "a" and "A"
are considered same characters.The
strncmpi function returns a negative value
if string1<string2, zero if both are equal, or
positive integer if string1 > string2 .
int strcmpi(dest,source,size_t);
strlwr( )
Syntax : strlwr(string_name);
strupr( )
strrev( )
Syntax : strrev(string_name);
Thanks!
Any questions?

More Related Content

What's hot

Functions in c language
Functions in c languageFunctions in c language
Functions in c languageTanmay Modi
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and StringTasnima Hamid
 
C Structures and Unions
C Structures and UnionsC Structures and Unions
C Structures and UnionsDhrumil Patel
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C v_jk
 
Strings Functions in C Programming
Strings Functions in C ProgrammingStrings Functions in C Programming
Strings Functions in C ProgrammingDevoAjit Gupta
 
Strings in C language
Strings in C languageStrings in C language
Strings in C languageP M Patil
 
Function in c program
Function in c programFunction in c program
Function in c programumesh patil
 
Functions in c language
Functions in c language Functions in c language
Functions in c language tanmaymodi4
 
Types of function call
Types of function callTypes of function call
Types of function callArijitDhali
 
String In C Language
String In C Language String In C Language
String In C Language Simplilearn
 
Operation on string presentation
Operation on string presentationOperation on string presentation
Operation on string presentationAliul Kadir Akib
 
Tokens expressionsin C++
Tokens expressionsin C++Tokens expressionsin C++
Tokens expressionsin C++HalaiHansaika
 
Structures in c language
Structures in c languageStructures in c language
Structures in c languagetanmaymodi4
 
Pointers in c language
Pointers in c languagePointers in c language
Pointers in c languageTanmay Modi
 

What's hot (20)

Functions in c language
Functions in c languageFunctions in c language
Functions in c language
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and String
 
C Structures and Unions
C Structures and UnionsC Structures and Unions
C Structures and Unions
 
Strings
StringsStrings
Strings
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 
Strings Functions in C Programming
Strings Functions in C ProgrammingStrings Functions in C Programming
Strings Functions in C Programming
 
File in C language
File in C languageFile in C language
File in C language
 
Strings in C language
Strings in C languageStrings in C language
Strings in C language
 
Function in c program
Function in c programFunction in c program
Function in c program
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Types of function call
Types of function callTypes of function call
Types of function call
 
String In C Language
String In C Language String In C Language
String In C Language
 
String C Programming
String C ProgrammingString C Programming
String C Programming
 
Operation on string presentation
Operation on string presentationOperation on string presentation
Operation on string presentation
 
Tokens expressionsin C++
Tokens expressionsin C++Tokens expressionsin C++
Tokens expressionsin C++
 
C functions
C functionsC functions
C functions
 
Structure c
Structure cStructure c
Structure c
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
Pointers in c language
Pointers in c languagePointers in c language
Pointers in c language
 
Functions in C
Functions in CFunctions in C
Functions in C
 

Similar to Implementation Of String Functions In C (20)

Chap 8(strings)
Chap 8(strings)Chap 8(strings)
Chap 8(strings)
 
String & its application
String & its applicationString & its application
String & its application
 
Strings part2
Strings part2Strings part2
Strings part2
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSTRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
 
String in c programming
String in c programmingString in c programming
String in c programming
 
Strings
StringsStrings
Strings
 
string in C
string in Cstring in C
string in C
 
string
stringstring
string
 
Unitii string
Unitii stringUnitii string
Unitii string
 
Strings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiStrings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothi
 
String notes
String notesString notes
String notes
 
[ITP - Lecture 17] Strings in C/C++
[ITP - Lecture 17] Strings in C/C++[ITP - Lecture 17] Strings in C/C++
[ITP - Lecture 17] Strings in C/C++
 
String Library Functions
String Library FunctionsString Library Functions
String Library Functions
 
String handling
String handlingString handling
String handling
 
14 strings
14 strings14 strings
14 strings
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
String (Computer programming and utilization)
String (Computer programming and utilization)String (Computer programming and utilization)
String (Computer programming and utilization)
 
Strings CPU GTU
Strings CPU GTUStrings CPU GTU
Strings CPU GTU
 
Strings.ppt
Strings.pptStrings.ppt
Strings.ppt
 
PPS Presentation.pptx
PPS Presentation.pptxPPS Presentation.pptx
PPS Presentation.pptx
 

Recently uploaded

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 

Recently uploaded (20)

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 

Implementation Of String Functions In C

  • 2. Hello! I Am Fazila Sadia Roll No. : BM -014
  • 4. “Strings are actually array of characters terminated by a null character.Each character occupies one byte of memory.
  • 5. String Functions The prototypes of string functions can be found in string.h file.The following is a list of functions found within the <string.h> header file:
  • 6. strlen( ) name_variable=strlen(string_name); Function strlen( ) returns value of type integer Synatax Of strlen( ) :
  • 8. Without Using Built In Function
  • 9. String Concatenation String concatenation is the operation of joining character strings end-to-end. For example, the concatenation of "snow" and "ball" is "snowball. For two sets of strings S1 and S2, the concatenation S1S2 consists of all strings of the form vw where v is a string from S1 and w is a string from S2 .
  • 10.
  • 11.
  • 12.
  • 13. strcpy( ) Syntax Of strcpy strcpy(dest,source); Here, source and destination are both the name of the string. This statement, copies the content of string source to the content of string destination.
  • 15.
  • 16. If destination string length is less than source string, entire source string value won’t be copied into destination string. For example, consider destination string length is 20 and source string length is 30. If you want to copy 25 characters from source string using strncpy( ) function, only 20 characters from source string will be copied into destination string and remaining 5 characters won’t be copied and will be truncated. strncpy( ) strncpy(dest,source,size of) Syntax Of strcpy( ):
  • 17.
  • 18. Syntax Of strcmp( ) int strcmp (str_1,str_2); strcmp is case sensitive, i.e "a" and "A" are treated as different characters
  • 19.
  • 20.
  • 21. strncmp( ) Syntax Of strncmp( ) int strncmp(dest,source,size_t); The strncmp function returns a negative, zero, or positive integer depending on whether the first n characters of the object pointed to by s1 are less than, equal to, or greater than the first n characters of the object pointed to by s2. The strncmp function will stop comparing if a null character is encountered in either s1 or s2
  • 22.
  • 23. strcmpi( ) Syntax Of strcmpi This function is not case i.e "a" and "A" are considered same characters.The strncmpi function returns a negative value if string1<string2, zero if both are equal, or positive integer if string1 > string2 . int strcmpi(dest,source,size_t);
  • 24.
  • 25. strlwr( ) Syntax : strlwr(string_name);
  • 26.
  • 28.
  • 29. strrev( ) Syntax : strrev(string_name);