Home / C Programming / Functions :: Discussion

Discussion :: Functions

  1. Point out the error in the program

     f(int a, int b)
     {     
        int a;   
        a = 20;   
        return a; 
     }
    

  2. A.

    Missing parenthesis in return statement

    B.

    The function should be defined as int f(int a, int b)

    C.

    Redeclaration of a

    D.

    None of above

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    f(int a, int b) The variable a is declared in the function argument statement.

    int a; Here again we are declaring the variable a. Hence it shows the error "Redeclaration of a"


Be The First To Comment