Question: //So in my understanding of this method takes buff1[] array and buffersize as input and it calls readInput() method by sending the buff array and

//So in my understanding of this method takes buff1[] array and buffersize as input and it calls readInput() method by sending the buff array and bufferSize. The for loop executes up to bufSize and has a pre incremented i. It then if (buf1[i] != buf2[bufSize - 1 -i] returns true, the bomb explodes. I intiallly thought that any palindrome would work, but that was not correct. Is the first for loop execution at i = 1? Also, I know that in C programming that the compiler signifies the end of char array with the ' ' character...is this taken into account in the loop? (I will display the readInput() method below part6() method for clarity. Also, if any of what I think I know is incorrect, knowing that would be helpful. Basically I need an extensive run through of EXACTLY what the code does. This is a hw assignment so I need to fully understand the concepts.

void part6(const char buf1[], const int bufSize){ char buf2[bufSize]; int i, c;

readInput(buf2, bufSize);

for(i=0; i

--------------------------------------------------------------------- (read input method)

void readInput(char buffer[], const int bufferSize){ int i; int c; for(i=0; i<=bufferSize; ++i){ c = getchar(); /* this checks that you are at the end of the line */ /* Windows encodes an endofline as two characters: */ /* Linux just uses */ /* This will accept either version */ if(c == ' '){ c = getchar(); } if(c == ' '){ break; } else if(i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!