0% found this document useful (0 votes)
11 views13 pages

C Language String Functions Guide

The document provides an overview of strings in the C programming language, defining a string as a collection of characters terminated by a null character. It includes information on string variable declaration, input/output functions, and standard library functions such as strlen, strcpy, strcat, and strcmp. The document is presented by a group of students and concludes with a thank you note.

Uploaded by

mfiuk9148
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views13 pages

C Language String Functions Guide

The document provides an overview of strings in the C programming language, defining a string as a collection of characters terminated by a null character. It includes information on string variable declaration, input/output functions, and standard library functions such as strlen, strcpy, strcat, and strcmp. The document is presented by a group of students and concludes with a thank you note.

Uploaded by

mfiuk9148
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

STRING

C LANGUAGE
Presented by
 CS 2304040 –Tanvir
 CS 2304041 -Ashik
 CS 2304043 -Rafy
 CS 2304046 –Tosikul
 CS 2304055 -Tofiq
 CS 2304056 -Shreya
 CS 2304057 -Ashik
What is string…..
String-A sequential collection of characters
or a character Array terminated by a null
character(‘\0’)
Header file of string…
#include<stdio.h>
#include<string.h>
 `<string.h>` is a header file in the C
programming language that provides a set of
functions for manipulating strings.
Contents

Declaration
variable declaration
input/output and format specifiers
 Standard library functions
 String codes.
String variable
declaration
 Char name[]=“rafy”; char
random[]={‘a’,’1’,’*’,’y’};
Printf(“%s”, name); printf(“%s”, random);
‘r’ ‘a’ ‘f’ ‘y’ ‘\ ‘a’ ‘1’ ‘*’ ‘y’ ‘\0’

0’
String input output
Input function : scanf / gets / fgets
Example
scanf(“%s”, name); // input a single word
scanf(“%[^\n]s”, name); // input a sentence
gets(name); // input a single word
fgets(name,sizeof(name),stdin); // input a sentence
Output function: printf/puts
printf(“name is= %s”, name);
puts(name);
Format Specifier
%s
Standard Library
Functions<string.h>
 strlen : returns length of the string
int strlen (const char *)
 strcpy : copy one string into another
char strcpy (char *, const char *)
strcpy(s1,s2);
 strcat : concantenates (combines) two strings
char strcat (char *, const char *)
strcat(s1,s2);
 strcmp : compare two strings
int strcmp (const char *, const char *)
res = strcmp (s1,s2);
String
length(strlen)
String copy(strcpy)
String concantenates (strcat
)
String compare(strcmp)
Thank You
Everyone…..

You might also like