Categories: C LanguageLearn C++

String function in C programming Language

In this tutorial, we will discuss the String function in C programming Language

In this post, we are going to learn about pre-defined string functions in C language and how to use it

Strings are always enclosed by double quotes, Whereas , character is enclosed by single quotes in C likes other language

The string library function which is  built in C language to handle of String with some readymade functions

String functions is used coping one string to other string, concatenates two strings , finding the length of the string,String comparison and replace or insert strings etc……

string.h header file supports all the string functions in C language. and String functions are given below

1. strcat ()- Concatenates two string, Str2 can be concatenates  at the end of the str1

2. strncat() – Appends a portion of String to another
3. strcpy() – Copies String2  into String 1
4. strncpy() – Copies given number of characters of one String to another
5. strlen()- Gives the leanth of given String
6. strcmp() –
Return 0 value if String 1 is same as String 2.
Return < 0 ,if String 1<String 2.
Return >0 if String1>String2
7. strcmpi() – Same as strcmp() function but this function negotiates case “A” and “a” are treated as same
8. strchr() – Returns pointer to first occurrence of char in String 1
9. strrchr() –  Last occurrence of given character in a String is found
10. strstr() – Return pointer to first occirrence of String 2 in String 1
11. strrstr() –  Return pointer to last occirrence of String 2 in String 1
12. strdup() – Duplicates the given String
13. strlwr() – Convert string to lover case
14. strupr() – Convert string to upper case
15. strrev() – Reverses the given string
16. strset() – Sets all charecters in a string to given charecter
17. strnset() – It’s sets the portion of charecters in a string to given charecter
18. strtok() – Tokenizing given String using delimiter
Suggested post

Function in C language

Karmehavannan

Recent Posts

Subtract two numbers using method overriding

Subtract two numbers using method overriding   Program 1

3 months ago

PHP Star triangle Pattern program

PHP Star triangle Pattern program Here's a simple Java program that demonstrates how to print…

3 months ago

Using function or method to Write temperature conversion : Fahrenheit into Celsius

Using Function or Method to Write to temperature conversion: Fahrenheit into Celsius In this article,…

1 year ago

Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user

Function or method of temperature conversion from Fahrenheit into Celsius In this article, we will…

1 year ago

Write temperature conversion program: Fahrenheit into Celsius

Write temperature conversion program: from Fahrenheit to Celsius In this article, we will discuss the…

1 year ago

How to write a program to convert Fahrenheit into Celsius

How to write a program to convert Fahrenheit into Celsius In this article, we will…

1 year ago

This website uses cookies.