Semester : S1 and S2
Subject : Computer Programming
Year : 2017
Term : DECEMBER
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:19
It concatenates two strings and returns the concatenated string.
Example of strcat:
#include
#include
main() { char s1[10]
= "Hello"; char
s2[10] = "World";
5352೦೩೬ (51, 82) 7
1011117 ("Output string after concatenation: 55", 51);
return 0;
Output:
Output string after concatenation: HelloWorld
3. strlen(s1);
٠ Returns the length of string 51. C
String function - strlen
Syntax: size t strlen(const
char *str)
size_t represents unsigned short
It returns the length of the string without including end character (terminating char എ).
Example of strlen:
#include
#include
main() {
char str1[20] = "BeginnersBook";
printf("Length of string 3:71: 50", 5८८1687 (57८1) ) ;
return 0;
}
Output:
Length of string 51८1: 13
4. strcmp(s1, 52);
* Returns 0 if 51 and 52 are the same;
٠ less than 0 if s1
C String function - strcmp int stremp(const char
ഥി, const char *str2)