Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

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;
expand button
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"
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education