Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Replace any space ' ' with '_' in 2-character string passCode. Sample output for the given program: 1_ My program needs to do the above.

Replace any space ' ' with '_' in 2-character string passCode. Sample output for the given program:

1_

My program needs to do the above. I believe most of my code is correct but it keeps failing the final Test as you can see from the attached picture. I would apperciate it if you could tell me what I need to alter to pass all the tests.

#include #include #include

int main(void) { char passCode[3];

strcpy(passCode, "1 ");

if (isspace(passCode[0]))

{

passCode[0]='_';

}

else if (isspace(passCode[1]))

{

passCode[1]='_';

}

else if (isspace(passCode[2]))

{

passCode[2]='_';

}

else if (isspace(passCode[3]))

{

passCode[3]='_';

}

printf("%s ", passCode); return 0; }

image text in transcribed

Testing: "1 Your output 1 Testing: "a1" Your output al Testing:? Your output Testing." " Output differs. See highlights below. Special character legend Your output Expected output

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions