-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path17.c
More file actions
34 lines (28 loc) · 660 Bytes
/
Copy path17.c
File metadata and controls
34 lines (28 loc) · 660 Bytes
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
#include <stdio.h>
char* locate(char *s1, char *s2, int m)
{
int i, j;
static char temp[100];
for (i=0; i< m; i++)
temp[i] = s1[i];
for (j=0; s2[j] != '\0'; j++)
temp[i+j] = s2[j];
for (; s1[i] != '\0'; i++)
temp[i+j] = s1[i];
return temp;
}
int main()
{
char s1[100], s2[100];
int m;
printf("Enter your string: ");
scanf("%[^\n]s", s1);
printf("Enter your string: ");
scanf(" %[^\n]s", s2);
printf("Enter your index: ");
scanf("%d", &m);
char *updated_string;
updated_string = locate(s1, s2, m);
printf("Your string is: %s", updated_string);
return 0;
}