Home » Programming & Data Structure » Programming and data structure miscellaneous » Question

Programming and data structure miscellaneous

Programming & Data Structure

  1. Consider the following function written in the C programming languages.
    void foo(char *a)
    {
       if(*a && *a != ‘ ’)
       {
       foo(a+1);
       putchar(*a);
       }
    }
    The output of the above function on input "ABCD EFGH" is
    1. ABCD EFGH
    2. ABCD
    3. HGFE DCBA
    4. DCBA
Correct Option: D


if condition fails & returns controls
∴ DCBA will be pointed



Your comments will be displayed only after manual approval.