What Is String? Explain All Library Function Of String.

3 years ago
C Programming

String: – String is the group of sequential character array. String is the one dimensional character array. String always terminate in the Null character ‘\0’. The string data types is char and string with space taking 1 bytes/ taking the string without using any loops.

Library Function Of String 

The standard library function is special function which is included as <string.h> library. It contain some function this are given below.

strlen(): – strlen() is a function of library <string.h>. it used to find the lenth of any string.

Ex –

Char str[20] = “string”; int len;

len = strlen(str)

strcmp(): – strcmp is a inbuilt library function,. it library function is <string.h>. strcmp use to compare two string. The string will be same this function return also 0. Otherwise it return anuthing like -1,1,2 but not 0;

strcat(): – strcat function is the library inbuilt function. The library of this function is

<string.h>. it used to perform string operations. It use to concatenate/ joint two string in one.

strcpy(): – the strcpy is the inbuilt library function. The library his function is <string.h>. and it used to copy string one to another.

Syntax – strcpy(str1,str2) str2 copy to str1.

0
Rusma Khadka
Dec 27, 2022
More related questions

Questions Bank

View all Questions