Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include<stdio.h> #include<string.h> int main() { char input[100]; int len = str

ID: 3747380 • Letter: #

Question

#include<stdio.h>
#include<string.h>

int main()
{

char input[100];
int len = strlen(input);
char output1[100];
char output2[] = "Copied string is - ";


printf("Enter your desired string of characters: ");
   gets(input);

printf("The length of the string you entered is: %d ", len);

strcpy(output1,input);
    printf("The copy of the string you entered is: %s ", output1);

strcat(output2, input);
   printf("The Concatenated String is: %s ", output2);


return 0;


}

practice.c: In function 'main' practice.c:35:5: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] gets (input)

Explanation / Answer

#include<stdio.h>
#include<string.h>

int main()
{

char input[100];
int len = strlen(input);
char output1[100];
char output2[] = "Copied string is - ";


printf("Enter your desired string of characters: ");
scanf("%c", &len);

printf("The length of the string you entered is: %d ", len);

strcpy(output1,input);
printf("The copy of the string you entered is: %s ", output1);

strcat(output2, input);
printf("The Concatenated String is: %s ", output2);


return 0;


}