strlen()- this function is used to find the length of a string. It counts
the number of characters comprising the string.
Syntax:
strlen(char[] str)- finds the length of the string str.
Example:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main() {
char str[] = "mystring";
int len=0;
clrscr();
len=strlen(str);
printf("Length of string is :%d",len);
getch();
}
Strcpy()– this function is used to copy the contents of a string to other.
Syntax:
strcpy(char[] dest, char[] source)- copies the contents of the string
source to destination.
Example:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main() {
char source[]="mystring";
char dest[10];
clrscr();
printf("%s%s",source,dest);
strcpy(dest,source);
printf("\n%s %s",source, dest);
getch();
}