SlideShare a Scribd company logo
5
Most read
6
Most read
7
Most read
String Handling Functions
21CSC2T411: Programming in C
SIMMI S
Assistant Professor
Department Of Computer Science(UG)
Kristu Jayanti College,Autonomous
Bengaluru -560077,India
Strings
The string can be defined as the one-dimensional array of characters
terminated by a null ('0') character.
The character array or the string is used to manipulate text such as
word or sentences.
The termination character ('0') is important in a string since it is the
only way to identify where the string ends.
Simmi S,Department of Computer Science
Syntax: char string_name[size];
char name[10]; //Declaration
char name[]=“rose”; //Declaration and Initialization
char name[]={‘r’,’o’,’s’,’e’,’0’} //Declaration and Initialization
Declaring String
Simmi S,Department of Computer Science
String Handling Functions
• The C string functions are built-in functions that can be used for
various operations and manipulations on strings.
• These string functions can be used to perform tasks such as string
copy, concatenation, comparison, length, etc.
• The string handling functions are defined in a header file
called string.h.
Simmi S,Department of Computer Science
Types Of String Handling Functions
Function Syntax (or) Example Description
strcpy() strcpy(string1, string2) Copies string2 value into string1
strncpy() strncpy(string1, string2, 5) Copies first 5 characters string2 into string1
strlen() strlen(string1) Returns total number of characters in string1
strcat() strcat(string1,string2) Appends string2 to string1
strncat() strncpy(string1, string2, 4) Appends first 4 characters of string2 to string1
strcmp() strcmp(string1, string2) Returns 0 if string1 and string2 are the same;
less than 0 if string1<string2; greater than 0 if
string1>string2
strncmp() strncmp(string1, string2, 4) Compares first 4 characters of both string1 and
string2
Simmi S,Department of Computer Science
strlen()
Simmi S,Department of Computer Science
strcpy() & strncpy()
Simmi S,Department of Computer Science
strcmp() & strncmp()
Simmi S,Department of Computer Science
strcat() & strcat()
Simmi S,Department of Computer Science
Simmi S,Department of Computer Science
Thank You

More Related Content

PPTX
Programming in c Arrays
PPTX
Functions in c language
PPTX
C programming - String
PPTX
Functions in C
PDF
C Programming Assignment
PDF
Introduction to c++ ppt
PPT
Structure in C
PPTX
Break and continue in C
Programming in c Arrays
Functions in c language
C programming - String
Functions in C
C Programming Assignment
Introduction to c++ ppt
Structure in C
Break and continue in C

What's hot (20)

PPT
structure and union
PPTX
Union in c language
PPTX
Structure in C
PPTX
Operators and expressions in c language
PPTX
Command line arguments
PPTX
Control statements in c
PPT
Constants in C Programming
PPTX
Character set of c
PPT
Strings
PPTX
Input and Output In C Language
PPTX
Arrays in c
PPTX
Array Introduction One-dimensional array Multidimensional array
PPTX
Strings in C language
PPT
Two Dimensional Array
PPTX
Decision Making Statement in C ppt
PPTX
Pointer arithmetic in c
PDF
Character Array and String
PPT
Structure of a C program
PPTX
K - Map
structure and union
Union in c language
Structure in C
Operators and expressions in c language
Command line arguments
Control statements in c
Constants in C Programming
Character set of c
Strings
Input and Output In C Language
Arrays in c
Array Introduction One-dimensional array Multidimensional array
Strings in C language
Two Dimensional Array
Decision Making Statement in C ppt
Pointer arithmetic in c
Character Array and String
Structure of a C program
K - Map
Ad

Similar to STRING HANDLING FUNCTIONS.pdf (20)

PPTX
COm1407: Character & Strings
PDF
Lk module3
PDF
Strings-Computer programming
PPTX
Strings in C programming language for students
PDF
CP Handout#8
PPTX
C programming basic concepts of mahi.pptx
PPTX
String.pptx
PDF
Tokens In C.pdf
PPTX
Array.pptx
DOC
Ocs752 unit 3
PDF
SPL 5 | scanf in C
PPTX
Character Arrays and strings in c language
PPTX
Basic Concepts of C Language.pptx
PPTX
Computer programming and utilization 2110003
PDF
Data structure week 3
PPTX
C Programming - Basics of c -history of c
PPTX
Console I/o & basics of array and strings.pptx
PPT
14 strings
PPT
Lecture 05 2017
PPTX
Strings in C - covers string functions
COm1407: Character & Strings
Lk module3
Strings-Computer programming
Strings in C programming language for students
CP Handout#8
C programming basic concepts of mahi.pptx
String.pptx
Tokens In C.pdf
Array.pptx
Ocs752 unit 3
SPL 5 | scanf in C
Character Arrays and strings in c language
Basic Concepts of C Language.pptx
Computer programming and utilization 2110003
Data structure week 3
C Programming - Basics of c -history of c
Console I/o & basics of array and strings.pptx
14 strings
Lecture 05 2017
Strings in C - covers string functions
Ad

More from simmis5 (11)

PPTX
Software reuse is the use of existing artifacts to build new software compone...
PPTX
Unified Modeling Language in Software Engineering
PDF
JAVA SWING:Swing is a Java Foundation Classes [JFC] library and an extension ...
PDF
The Concept of Abstract Window Took Kit In Java
PDF
Java Programming :Event Handling(Types of Events)
PDF
Software Engineering :Project Management
PDF
The Concept Of Multithreading In Java Programming
PDF
Conditional Statements & Loops
PDF
Multiplexer.pdf
PDF
Encoder_decoder_si.pdf
PDF
c_algo_flowchart.pdf
Software reuse is the use of existing artifacts to build new software compone...
Unified Modeling Language in Software Engineering
JAVA SWING:Swing is a Java Foundation Classes [JFC] library and an extension ...
The Concept of Abstract Window Took Kit In Java
Java Programming :Event Handling(Types of Events)
Software Engineering :Project Management
The Concept Of Multithreading In Java Programming
Conditional Statements & Loops
Multiplexer.pdf
Encoder_decoder_si.pdf
c_algo_flowchart.pdf

Recently uploaded (20)

PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
L1 - Introduction to python Backend.pptx
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Introduction to Artificial Intelligence
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
history of c programming in notes for students .pptx
PPTX
Transform Your Business with a Software ERP System
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Essential Infomation Tech presentation.pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
System and Network Administraation Chapter 3
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
medical staffing services at VALiNTRY
PDF
Understanding Forklifts - TECH EHS Solution
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Softaken Excel to vCard Converter Software.pdf
L1 - Introduction to python Backend.pptx
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Introduction to Artificial Intelligence
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
history of c programming in notes for students .pptx
Transform Your Business with a Software ERP System
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Essential Infomation Tech presentation.pptx
Odoo Companies in India – Driving Business Transformation.pdf
System and Network Administraation Chapter 3
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
2025 Textile ERP Trends: SAP, Odoo & Oracle
medical staffing services at VALiNTRY
Understanding Forklifts - TECH EHS Solution
How to Migrate SBCGlobal Email to Yahoo Easily

STRING HANDLING FUNCTIONS.pdf

  • 1. String Handling Functions 21CSC2T411: Programming in C SIMMI S Assistant Professor Department Of Computer Science(UG) Kristu Jayanti College,Autonomous Bengaluru -560077,India
  • 2. Strings The string can be defined as the one-dimensional array of characters terminated by a null ('0') character. The character array or the string is used to manipulate text such as word or sentences. The termination character ('0') is important in a string since it is the only way to identify where the string ends. Simmi S,Department of Computer Science
  • 3. Syntax: char string_name[size]; char name[10]; //Declaration char name[]=“rose”; //Declaration and Initialization char name[]={‘r’,’o’,’s’,’e’,’0’} //Declaration and Initialization Declaring String Simmi S,Department of Computer Science
  • 4. String Handling Functions • The C string functions are built-in functions that can be used for various operations and manipulations on strings. • These string functions can be used to perform tasks such as string copy, concatenation, comparison, length, etc. • The string handling functions are defined in a header file called string.h. Simmi S,Department of Computer Science
  • 5. Types Of String Handling Functions Function Syntax (or) Example Description strcpy() strcpy(string1, string2) Copies string2 value into string1 strncpy() strncpy(string1, string2, 5) Copies first 5 characters string2 into string1 strlen() strlen(string1) Returns total number of characters in string1 strcat() strcat(string1,string2) Appends string2 to string1 strncat() strncpy(string1, string2, 4) Appends first 4 characters of string2 to string1 strcmp() strcmp(string1, string2) Returns 0 if string1 and string2 are the same; less than 0 if string1<string2; greater than 0 if string1>string2 strncmp() strncmp(string1, string2, 4) Compares first 4 characters of both string1 and string2 Simmi S,Department of Computer Science
  • 7. strcpy() & strncpy() Simmi S,Department of Computer Science
  • 8. strcmp() & strncmp() Simmi S,Department of Computer Science
  • 9. strcat() & strcat() Simmi S,Department of Computer Science
  • 10. Simmi S,Department of Computer Science Thank You