Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Q3, what is the output of the code shown below. Explain your answer. Your explan

ID: 3705674 • Letter: Q

Question

Q3, what is the output of the code shown below. Explain your answer. Your explanation must clearly demonstrate you understood the algorithm. #include void dummyFunc (char* ptr): int main(void) char str[seaaaaabcccaaaaffee dummyFunc(str); printf("xsIn", str): void dummyFunc(char* ptr) ( char curr"ptr int nun e; int i, j: for (1+ e, j-e; i c. strlen(ptr); i ) { if (curr *(ptr + i)){ nun+: else f ptrl] curr f (num>1) ptr[j] -'e. + num; curr (ptr i) (ptr ) e Hint you can explain your answer following trese guidelines (not limited to -What is going on in the main function Prototype of the function dummyFunc What are the variables used inside the function dummFunc - What is the for loop for - What is the i statement for - What is the else statement for What is the statement after the for loop for

Explanation / Answer

Output:  a5bc3a4f2e2

1. In the main function, the dummyFunc is called in which character array is passed

2. In the prototype of dummyFunc, the base pointer of character array is passed

3. Variables used in dummyFunc are: curr, num,i,j;

4. For loop counts the number of occurrences along with the word itself

5. If statements check if the next letter is same as the previous character

6. in else condition, the number of occurrences are put into an array and the old array is skipped to the number of repeated characters

7. The last value of the array is put to '' to terminate the array