Functions

Q1: Point out the error in the program

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

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

B None of above

C Redeclaration of a

D Missing parenthesis in return statement

ANS:C - Redeclaration of 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"



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.