-
Notifications
You must be signed in to change notification settings - Fork 1
/
str2.c
42 lines (33 loc) · 845 Bytes
/
str2.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
#include <stdio.h>
#include <string.h>
int main()
{
int i, len, cmp;
char s1[100], s2[100];
char st1[] = "abc";
char st2[] = "def";
printf("Please enter a string: ");
gets(s1);
printf("Enter a string to compare: ");
gets(s2);
printf("\nThe first string is: %s", s1);
printf("\nThe second string is: %s", s2);
len = strlen(s1);
cmp = strcmp(s1, s2);
printf("\nThe length of the string: %d", len);
printf("\nString comparison: %d\n", cmp);
printf("%s\n%s\n", st1,st2);
//strcpy(st1, st2);
strcat(st1, st2);
printf("%s\n%s\n",st1, st2);
return 0;
}
int print(char *arr, int size)
{
int len, i;
len = strlen(arr);
for(int i = 0; i < size; i++)
{
}
}
}