Software Archive
Read-only legacy content

what is this

BYRTYRTYRTY__TRBYTRY
458 Views

Hello sir

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

0 Kudos
2 Replies
stalin__christoper
458 Views

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

0 Kudos
Chowdhury__Afreen
458 Views

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().

0 Kudos
Reply