Question: c++ Consider the following recursive function. What does it do? You may assume that ptr initially points to a character array initialized to a string
c++
Consider the following recursive function. What does it do? You may assume that ptr initially points to a character array initialized to a string literal (the final character of which will always be the 'IO' terminator character). int func(char* ptr) \{ if(*ptr == ' \0) return 0; return 1+ func ( ptr +1); \} (A) Stack Overflow (due to infinite recursion) (B) Calculates the number of characters in the string referenced by ptr. (C) Calculates the size of the character array referenced by ptr. (D) The results are unpredictable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
