The following program has 12 total bugs in it. Find the bugs and on the next page indicate the line number on which the bug occurs AND provide a brief description of what is wrong. (You are given the first one as an example. You need to find the remaining 11 bugs.) A bug is defined as a compilation error that would keep the program from being compiled by the gcc compiler, a runtime error that causes the program to crash, or an error in logic that would prevent the proper operation of the code, e.g., choosing the wrong branch in a selection statement. Note: there may be more than one bug on a single line. If so, be sure to list all bugs separately! For example, if Line 8 had two bugs, you would list them separately as: "Line 8. First bug in Line 8"; "Line 8. Second bug in Line 8" This would count as 2 of the remaining 11 bugs. (Obviously, there are no bugs in Line 8. This is just an example.) 1 #include // Returns true if the char array s is a nalindrome
The following program has 12 total bugs in it. Find the bugs and on the next page indicate the line number on which the bug occurs AND provide a brief description of what is wrong. (You are given the first one as an example. You need to find the remaining 11 bugs.) A bug is defined as a compilation error that would keep the program from being compiled by the gcc compiler, a runtime error that causes the program to crash, or an error in logic that would prevent the proper operation of the code, e.g., choosing the wrong branch in a selection statement. Note: there may be more than one bug on a single line. If so, be sure to list all bugs separately! For example, if Line 8 had two bugs, you would list them separately as: "Line 8. First bug in Line 8"; "Line 8. Second bug in Line 8" This would count as 2 of the remaining 11 bugs. (Obviously, there are no bugs in Line 8. This is just an example.) 1 #include // Returns true if the char array s is a nalindrome
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
Related questions
Question
100%
C programming Debugging
![Example: Line 1. Code includes bool datatype, so we
need #include <stdbool.h>
2.
6.
9.
10.
1.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F316b704e-e082-4931-84f1-47d5ade043d7%2F1b819bdd-06c0-4892-8739-65a029ffc0c5%2F7zaiz3k_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Example: Line 1. Code includes bool datatype, so we
need #include <stdbool.h>
2.
6.
9.
10.
1.
![The following program has 12 total bugs in it. Find the bugs and on the next page indicate the line
number on which the bug occurs AND provide a brief description of what is wrong. (You are
given the first one as an example. You need to find the remaining 11 bugs.) A bug is defined as a
compilation error that would keep the program from being compiled by the gcc compiler, a
runtime error that causes the program to crash, or an error in logic that would prevent the proper
operation of the code, e.g., choosing the wrong branch in a selection statement. Note: there may
be more than one bug on a single line. If so, be sure to list all bugs separately! For example, if
Line 8 had two bugs, you would list them separately as: "Line 8. First bug in Line 8"; "Line 8.
Second bug in Line 8" This would count as 2 of the remaining 11 bugs. (Obviously, there are no
bugs in Line 8. This is just an example.)
1 #include <string.h>
2 |/ Returns true if the char array s is a palindrome,
3 // and false otherwise
4
5 bool palindrome (char s) {
7 for (int i = 0; i< sizeof(s); ++i) {
if (s[i] = s[strlen(s) –1- i]) {
return false;
8
9
10 }
11
12 return false;
13 }
14
15 // Simple routine that
16// 1. Requests a phrase
17// 2. Displays whether or not it is a palindrome
18 int main {
19 char s[100];
20 fprintf("Enter phrase: ");
21 scanf("%s", s);
22
23 if (!palindrome(s)) {
24 printf("%d is not a palindrome\n", s);
25 }
26 printf("%s is a palindrome\n", s)
27 }](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F316b704e-e082-4931-84f1-47d5ade043d7%2F1b819bdd-06c0-4892-8739-65a029ffc0c5%2Fwt1ik2l_processed.jpeg&w=3840&q=75)
Transcribed Image Text:The following program has 12 total bugs in it. Find the bugs and on the next page indicate the line
number on which the bug occurs AND provide a brief description of what is wrong. (You are
given the first one as an example. You need to find the remaining 11 bugs.) A bug is defined as a
compilation error that would keep the program from being compiled by the gcc compiler, a
runtime error that causes the program to crash, or an error in logic that would prevent the proper
operation of the code, e.g., choosing the wrong branch in a selection statement. Note: there may
be more than one bug on a single line. If so, be sure to list all bugs separately! For example, if
Line 8 had two bugs, you would list them separately as: "Line 8. First bug in Line 8"; "Line 8.
Second bug in Line 8" This would count as 2 of the remaining 11 bugs. (Obviously, there are no
bugs in Line 8. This is just an example.)
1 #include <string.h>
2 |/ Returns true if the char array s is a palindrome,
3 // and false otherwise
4
5 bool palindrome (char s) {
7 for (int i = 0; i< sizeof(s); ++i) {
if (s[i] = s[strlen(s) –1- i]) {
return false;
8
9
10 }
11
12 return false;
13 }
14
15 // Simple routine that
16// 1. Requests a phrase
17// 2. Displays whether or not it is a palindrome
18 int main {
19 char s[100];
20 fprintf("Enter phrase: ");
21 scanf("%s", s);
22
23 if (!palindrome(s)) {
24 printf("%d is not a palindrome\n", s);
25 }
26 printf("%s is a palindrome\n", s)
27 }
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education