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 output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
