Question
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
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; }
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 outputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started