C Programming - Functions - Discussion

Discussion Forum : Functions - Point Out Errors (Q.No. 1)
1.
Point out the error in the program

f(int a, int b)
{
    int a;
    a = 20;
    return a;
}
Missing parenthesis in return statement
The function should be defined as int f(int a, int b)
Redeclaration of a
None of above
Answer: Option
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"

Discussion:
14 comments Page 2 of 2.

Sayli said:   9 years ago
Yes, I totally agree with you @Rosmy.

Deepali Bajaj said:   7 years ago
The return type is not declared.
(1)

Sonia said:   1 decade ago
Can anyone explain me this?

HarishMahajan said:   7 years ago
How redeclaration of a?


Post your comments here:

Your comments will be displayed after verification.