what is this

what is this

Hello sir

What is this strcat(), strlen(),strcpy()

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

strcpy()

This function copies a string from source to destination. The function takes two string variables as arguments: the destination, and the source, then returns the updated destination variable.

strcat()

The strcat() function concatenates two strings. It appends a copy of the source string to the end of the destination string, and then returns the destination string.

 strlen()

I know you have been waiting for this!!! This function calculates the length of the string.

By web designing trainer

Shortly you just need to know;

1. strlen() -  calculates the length of string

2. strcat() -  Appends one string at the end of another

3. strcpy() - Copies a string into another

I am giving you the below example of strcpy(), try it to see the result;

#include <stdio.h>

#include <string.h>

int main()

{

char str1[10]= "awesome";

char str2[10];

char str3[10];

strcpy(str2, str1);

strcpy(str3, "well");

puts(str2);

puts(str3);

return 0;

}

 

Please post your result that i will bring two more example for you on strcat() and strlen().

Leave a Comment

Please sign in to add a comment. Not a member? Join today