Q3. What is the output of the code shown below. Ex demonstrate you understood th
ID: 3705713 • Letter: Q
Question
Q3. What is the output of the code shown below. Ex demonstrate you understood the algorithm. #include void dummyFunc(chan* ptr); int main(void) ( char str[50] = "ddddccccaaeeeesssz" dummyFunc (str); printf("%s ", str); void dummyFunc(chan* ptr) ( char curr a "ptri int num- 0 int i, j; i 1) ( ptrlj] '0' num; curr?"(ptr + num = 1; i); (ptr3)'; Hint you can explain your answer following these guidelines (not limited t -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 if 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
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.