Recent Posts

Tuesday 11 December 2018

String function

In the previous post we learn about what is String.we know that string is a collection of two or more characters.In string we can store alphabet, digit and special symbols.

In this post we will learn what are the string functions.

String functions:

1.strcpy ( ):
This function is used to copy the source string into target string.
Syntax: strcpy(target string, source string);
Example:

void main()

{
char stirng1[10],string[20];

clrscr();

printf("type first stirng");

scanf("%s",string1);

strcpy(string2,string1);

printf("second string=%s",string2");

}


Output:
type first string: programming
second string: programming

2.strlen ( ):
This function is used to find out the length of the string.
Syntax: strlen(string name);

3.strcmp ( );
This function is used to compare two strings.if both values are equal then it will return zero.if first string is greater than second string it return value greater than zero.if the value is less than zero then it is case sensitive.
Syntax: strcmp(string1,string2);

4.strcat():
This function appends means add second string at the end of first string.

Syntax: strcat(string1,string2);

5.strrev():
This function reverse contents of the given string and store it again in the same variable.
Syntax: strrev(string);


0 comments:

Post a Comment

Followers

Popular Posts

Categories

social media

Text Widget

Powered by Blogger.

About Me

My name is junaid khan and i am a full time blogger and author of a blog tutorial called tutorialpointsolution.

String function

In the previous post we learn about what is String .we know that string is a collection of two or more characters.In string we can store al...

Search This Blog

Technology

Adbox

Recent Post

Breaking

Recent In Internet

Comments

Facebook

Pages

Comments

Pages

Recent

Pages

Technology