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
icon
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.
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 }
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
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Introduction to computer system
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
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