1234
#include <stdio.h>
2 //void strcpy_1(char arr[],char arr1[]);
3 //int strlen_1(char *p);
4 //int strcmp_1(char *p,char *p1);
5 void strcat_1(char arr[],char arr1[]);
6 int main(void)
7 {
8 int i;
9 char arr[] = "abcdefg";
10 char arr1[] = "opqrst";
11
12 //printf("%d\n",strcmp_1(arr,arr1));
13
14 //strcpy_1(arr,arr1);
15 //printf("%s\n",arr);
16
17 //printf("%d\n",strlen_1(arr));
18
19 printf("%s\n",strcat_1(arr,arr1));
20 return 0;
21 }
22
23
24 /*void strcpy_1(char arr[],char arr1[])
25 {
26 int i,sum;
27 sum = sizeof(arr1) / sizeof(arr1[0]);
28
29 for (i = 0;i < sum;i ++)
30 {
31 if(arr1[i] != '\0')
32 {
33 arr[i] = arr1[i];
34 }
35 else
36 break;
37 }
38
39
40
41 }
42
43 */
44 /*int strlen_1(char *p)
45 {
46 int i;
47 for (i = 0;*p ++ !='\0';i ++)
48 ;
49 return i;
50
51 }
52 */
53
54 /*int strcmp_1(char *p,char *p1)
55 {
56 while(*p == *p1)
57 {
58 if(*p != 0)
59 return 0;
60 ++p;++p1;
61
62 }
63 return (*p - *p1);
64
65 }
66 */
67
68
69
70
71 void strcat_1(char arr[],char arr1[])
72 {
73 int i = 0;
74
75 while(arr[i] != 0)
76 {
77 i++;
78 }
79 int j = 0;
80 while(arr1[j] != '\0')
81 {
82 arr[i ++] = arr1[j ++];
83
84 }
85 arr[i] = '\0';
86 }