Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. ( 20 points) Here are four C programs to tratushate binary to decimal; that is, you rua / plo 101 and it will

image text in transcribed
2. ( 20 points) Here are four C programs to tratushate binary to decimal; that is, you rua " / plo 101 and it will print ' 5 '. For each program, indicate whether it works. If if does not, shour hoar to fix it hy changing the fewest characters possible. Note that these programs will crab if not given an argument; that's not considered an error per the design spec. Program A Works as is: Needs fixing. "include stdio, h> \#include \#include int main (int argc, char *argv[) i int val=0; // warning: assumes argv[1]! int len =strlen(argv[1]); for (int 1=0;1 Hinclude string. h> int main(int argc, char *argu(D) t int val=0; // warning: assumes argv[1]! int len - strlen(argv[1]) - 1; for (int 1=1 en; 1>0;10)t if (argv[1][1]=,1 ) val I=11 en; 3 print 1("d ",val); r Program D Works as is. Nends fixing. \#include \#include \#include int main(int argc, char *argv[) i int val =0; // warning: assunes argv[1]! int len =strlen(argv[1])1; for (int i=1 en; i>=0;1 ) } val+=(argv[1][1]0 ') (cen1); \} printf("%d ",val); \}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

=+4. What key skills are necessary to work in social media?

Answered: 1 week ago