SlideShare a Scribd company logo
3
Most read
9
Most read
10
Most read
String functions in C
String Functions in C
Typing Speed: 25

Ismail
Ismailpk456@gmail.com
Ismail Ismu
Ismail Ismu
in.linkedin.com/in/profilena
me
8086303494
String Function
The standard library for C string functions
is string.h. This header file defines tons
of useful string manipulation functions
including
String Functions

 strcmp
 strcat
 strcpy
 strlen
strcmp
• Strcmp() in C programming language is used
to compare two strings. If both the strings are
equal then it gives the result as zero but if not
then it gives the numeric difference between
the first non matching characters in the
strings.
strcat
• The strcat() function is used for string
concatenation in C programming language. It
means it joins the two strings together
strcpy
• strcpy function copies a string from a source
location to a destination location and provides
a null character to terminate the string.
strlen
The strlen( ) function is used to calculate the
length of the string. It means that it counts the
total number of characters present in the
string which includes alphabets, numbers, and
all special characters including blank spaces.
Strcmp
Syntax
int strcmp ( const char * str1, const char * str2 );

Example
int main()
{
char str1[30],str2[30];
printf("Enter first string: ");
scanf("%s",&str1);
printf("Enter second string: ");
scanf("%s",&str2);
if(strcmp(str1,str2)==0)
printf("Both strings are equal");
else printf("Strings are unequal");
return 0;
}
Strcat
Syntax
strcat(first_string,second_string);
Example
int main()
{
char str1[30]="www.cprogramming";
char str2[15]="expert.com";
printf("nn string 1 : %stt string 2 : %snn",str1,str2);
printf("nn strcat(str1,str2) : %snn", strcat(str1,str2));
getch();
Strcpy
Syntax
strcpy(destination,source);

Example
int main()
{
char a[10],b[10];
printf("Enter string: ");
scanf("%s",&a);
strcpy(b,a);
printf("Copied string: ");
printf("%s",b);
return 0;
}
Strlen
Syntax
temp_variable = strlen(string_name);

Example
int main()
{
char a[20];
printf("Enter string: ");
scanf("%s",&a);
printf("Length of string =%d n",strlen(a));
}
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.

Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550

Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
THE END

More Related Content

PPT
Properties of relations
PPTX
Programming in c Arrays
PPT
Decision making and branching
PDF
Time response second order
PPTX
Functions in C
PPTX
Data types in C
PPT
Introduction to c programming
PPTX
Two dimensional arrays
Properties of relations
Programming in c Arrays
Decision making and branching
Time response second order
Functions in C
Data types in C
Introduction to c programming
Two dimensional arrays

What's hot (20)

PPTX
Strings in C
PPTX
Functions in c++
PDF
Function overloading ppt
PPTX
Strings in C language
PPTX
PPTX
Strings in c++
PDF
Python tuple
PPTX
Functions in c language
PPTX
Pointer in c
PDF
Character Array and String
PPTX
Constructor in java
PPTX
Command line arguments
PPT
Array in c
PPTX
Array ppt
PPTX
Conditional Statement in C Language
PPTX
C Programming: Control Structure
PPTX
Introduction to Array ppt
PPTX
Structures in c language
PPTX
User defined functions in C
PPTX
classes and objects in C++
Strings in C
Functions in c++
Function overloading ppt
Strings in C language
Strings in c++
Python tuple
Functions in c language
Pointer in c
Character Array and String
Constructor in java
Command line arguments
Array in c
Array ppt
Conditional Statement in C Language
C Programming: Control Structure
Introduction to Array ppt
Structures in c language
User defined functions in C
classes and objects in C++
Ad

Viewers also liked (8)

PPT
Structure of a C program
PPTX
Arrays in C language
PPT
Structure in C
PPT
Structure c
PPTX
Array in c language
PPT
DOC
String in c
Structure of a C program
Arrays in C language
Structure in C
Structure c
Array in c language
String in c
Ad

Similar to String functions in C (20)

PPTX
Strings
PPTX
String handling
PDF
Strings in c mrs.sowmya jyothi
PPTX
Character Arrays and strings in c language
PDF
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
PPTX
Strings in C - covers string functions
PPTX
String in c programming
PPT
Strings in c
PDF
C programming & data structure [character strings & string functions]
PPTX
PPS Presentation.pptx
PPTX
Implementation Of String Functions In C
PPTX
String Handling in c++
PPTX
Strings cprogramminglanguagedsasheet.pptx
PDF
0-Slot21-22-Strings.pdf
PPTX
fundamentals of c programming_String.pptx
PPT
Operation on string presentation
PDF
Strings part2
Strings
String handling
Strings in c mrs.sowmya jyothi
Character Arrays and strings in c language
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
Strings in C - covers string functions
String in c programming
Strings in c
C programming & data structure [character strings & string functions]
PPS Presentation.pptx
Implementation Of String Functions In C
String Handling in c++
Strings cprogramminglanguagedsasheet.pptx
0-Slot21-22-Strings.pdf
fundamentals of c programming_String.pptx
Operation on string presentation
Strings part2

More from baabtra.com - No. 1 supplier of quality freshers (20)

PPTX
Agile methodology and scrum development
PDF
Acquiring new skills what you should know
PDF
Baabtra.com programming at school
PDF
99LMS for Enterprises - LMS that you will love
PPTX
Chapter 6 database normalisation
PPTX
Chapter 5 transactions and dcl statements
PPTX
Chapter 4 functions, views, indexing
PPTX
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
PPTX
Chapter 1 introduction to sql server
PPTX
Chapter 1 introduction to sql server
Agile methodology and scrum development
Acquiring new skills what you should know
Baabtra.com programming at school
99LMS for Enterprises - LMS that you will love
Chapter 6 database normalisation
Chapter 5 transactions and dcl statements
Chapter 4 functions, views, indexing
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 1 introduction to sql server
Chapter 1 introduction to sql server

Recently uploaded (20)

PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Pharma ospi slides which help in ospi learning
PDF
Classroom Observation Tools for Teachers
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
01-Introduction-to-Information-Management.pdf
PPTX
master seminar digital applications in india
PDF
Yogi Goddess Pres Conference Studio Updates
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
Orientation - ARALprogram of Deped to the Parents.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
Complications of Minimal Access Surgery at WLH
Pharma ospi slides which help in ospi learning
Classroom Observation Tools for Teachers
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Microbial disease of the cardiovascular and lymphatic systems
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
01-Introduction-to-Information-Management.pdf
master seminar digital applications in india
Yogi Goddess Pres Conference Studio Updates
2.FourierTransform-ShortQuestionswithAnswers.pdf
Final Presentation General Medicine 03-08-2024.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
VCE English Exam - Section C Student Revision Booklet
human mycosis Human fungal infections are called human mycosis..pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
O7-L3 Supply Chain Operations - ICLT Program

String functions in C