Some questions on generating the value in a function

  1. Why is the return in the following function redundant?
    void out2(int v1, int v2)
    {
       printf("%d, %d", v1, v2);
       return;
    }
    
  2. Why is it not necessary to have an else before the second return in the following function?
    int greater(int v1, int v2)
    {
       if (v1> v2) return v1;
       return v2;
    }
    

    Answers to these questions.


    Back to notes on generating return values.