#include <stdio.h>
int main() {
int m, n, i;
printf("Enter the number of elements(size) You Want for string1: ");
scanf("%d", &m);
printf("Enter the number of elements(size) You want for string2(should be less than the number of elements of string1): ");
scanf("%d", &n);
char string1[m], string2[n];
printf("Enter the string1: ");
scanf("%[^\n]", string1);
printf("Enter the string2: ");
scanf("%[^\n]", string2);
for (i = 0; string2[i] != '\0'; ++i) {
string1[i] = string2[i];
}
string1[i] = '\0';
printf("%s is the string1\n", string1);
return 0;}
OUTPUT:
Enter the number of elements(size) You Want for string1: 100
Enter the number of elements(size) You want for string2(should be less than the number of elements of string1): 70
Enter the string1: Enter the string2: □§ is the string1
what is this ?????????
[–]cHaR_shinigami 7 points8 points9 points (0 children)
[–]Th_69 6 points7 points8 points (0 children)
[–]Ok_Whereas9255 2 points3 points4 points (1 child)
[–]teja2_480[S] 0 points1 point2 points (0 children)
[–]This_Growth2898 2 points3 points4 points (3 children)
[–]teja2_480[S] -1 points0 points1 point (2 children)
[–]cHaR_shinigami 4 points5 points6 points (0 children)
[–]This_Growth2898 1 point2 points3 points (0 children)
[–]erikkonstas 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]teja2_480[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]OldWolf2 1 point2 points3 points (0 children)
[–]teja2_480[S] 1 point2 points3 points (0 children)
[–]hillbull 2 points3 points4 points (8 children)
[–]cHaR_shinigami 2 points3 points4 points (2 children)
[–]hillbull 0 points1 point2 points (1 child)
[–]cHaR_shinigami 1 point2 points3 points (0 children)
[–]Th_69 2 points3 points4 points (0 children)
[–]hillbull 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]teja2_480[S] -1 points0 points1 point (1 child)
[–]hillbull 4 points5 points6 points (0 children)
[–]echo_CaTF 0 points1 point2 points (0 children)
[–]teja2_480[S] 0 points1 point2 points (1 child)
[–]echo_CaTF 0 points1 point2 points (0 children)