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);


Related Posts:

  • 2d array in C In the previous post we learn about what is array and what is one dimensional array.In this post we will learn what is two dimensional array. What … Read More
  • what is high level language and low level language In the previous post we learnt about variable and data type.In this post we will learn about computer languages.Today computer can be programmed to u… Read More
  • Data types in C      In the previous post we learn about what is Variable in C language.In this post we will learn Data type in C.The data t… Read More
  • What is constant in C In the previous post we have learn about keywords. In this post we will learn about What is Constant they are also part of syntax. Consta… Read More
  • C programming language C programming language:what is C programming language: C is a Computer Programming language developed at AT & T's Bell Laboratories,USA in 1… Read More

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