-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBCTlec23.c
45 lines (33 loc) · 1.26 KB
/
BCTlec23.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//BCT Lecture 023
// String Function in C
//strlen(),strcpy(),strcmp(),strcat()
/* ...............Built in String functions in *string.h*..................
☢ int strlen(char *string); ☢ char *strcpy(char*dest,char *src);
-Determine the length of a string -copy source string into destination string
☢ int strcmp(char*s1,char *s2); ☢ char*strcat(char*s1,char*s2);
-compare string one and string two -Concatenate string s2 to string s1
( jora lagai) */
#include<stdio.h>
#include<string.h>
int main(){
char a[]= "Hello, ";//7 (space count kore).
char b[]= "World!";
int l = strlen(a);
int sz = strlen(b);
printf("Length of your string is :%d\n", l);
printf("Length of your string is :%d\n", sz);
strcat(a,b);
printf("%s\n",a); // using % of s
printf("%s\n",b);
printf("%s\n",a,b);
/* strcpy(a,b);
printf("Value of a is :%s\n",a);
printf("Value of b is :%s\n",b); */
int x = strcmp(a,b);
if(x==0){
printf("a and b is equal.\n");
} else{
printf("a and b is not equal.\n");
}
return 0;
}