Plz use c language to correct the errors in the coding, plz don't change the library and just correct the errors

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Question
Plz use c language to correct the errors in the coding, plz don't change the library and just correct the errors
#include<stdio.h>
define MAXS 1824
int concat(char*s1, char s2, char s3);
int main(void) {
int i, j, n;
char si[]="agree", s2[]="able";
char s3 [MAXS];
printf("Enter string si: ");
scanf("%c", &s1);
printf("Enter string s2: ");
scanf("%c", 8s2);
}
n = concat(s1, s2,s3);
printf("which is the length of: ");
scanf("%d", &n);
return e;
}
int concat(char*s1, char*s2, char*s3){
int i;
while (s1[1]!= '\0'){
$3[1]=s1[1];
while (s2[j]!= '\0'){
i++;
$3[1]=s2[1];
$3[n]='\0';
while (s3[n]!= '\0'){
++;
}
printf("The concatenation of the string: c" "and the string: %c" "is the string Xc");
scanf("%c %e %c", 8s1, 8s2, 8s3);
return n;
Transcribed Image Text:#include<stdio.h> define MAXS 1824 int concat(char*s1, char s2, char s3); int main(void) { int i, j, n; char si[]="agree", s2[]="able"; char s3 [MAXS]; printf("Enter string si: "); scanf("%c", &s1); printf("Enter string s2: "); scanf("%c", 8s2); } n = concat(s1, s2,s3); printf("which is the length of: "); scanf("%d", &n); return e; } int concat(char*s1, char*s2, char*s3){ int i; while (s1[1]!= '\0'){ $3[1]=s1[1]; while (s2[j]!= '\0'){ i++; $3[1]=s2[1]; $3[n]='\0'; while (s3[n]!= '\0'){ ++; } printf("The concatenation of the string: c" "and the string: %c" "is the string Xc"); scanf("%c %e %c", 8s1, 8s2, 8s3); return n;
Write a function called concat () which takes two strings s1 and 62 as arguments and sets
up a third string, s3, in which the second string is concatenated (i.e. added) to the end of
the first string. In other words, the third string consists of all the characters of s1 up to but
not including the null character followed by all the characters in s2 including the final null
character. For example, if s1 is "agree" and s2 is "able", then s3 would be "agreeable". The
function concat() should also return the length of s3. Include a main program which tests
your function.
Here is a sample run:
The concatenation of the string:
and the string: "able"
is the string: "agreeable"
which is 9 characters in length.
agree"
Transcribed Image Text:Write a function called concat () which takes two strings s1 and 62 as arguments and sets up a third string, s3, in which the second string is concatenated (i.e. added) to the end of the first string. In other words, the third string consists of all the characters of s1 up to but not including the null character followed by all the characters in s2 including the final null character. For example, if s1 is "agree" and s2 is "able", then s3 would be "agreeable". The function concat() should also return the length of s3. Include a main program which tests your function. Here is a sample run: The concatenation of the string: and the string: "able" is the string: "agreeable" which is 9 characters in length. agree"
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education