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;
}
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.
Rosmy said:
1 decade ago
@Ashish:
f(int a,int b)// a is declared as int.
{
int a; // error: Redeclaration.
...
}
f(int a,int b)// a is declared as int.
{
int a; // error: Redeclaration.
...
}
Sayli said:
9 years ago
Yes, I totally agree with you @Rosmy.
HarishMahajan said:
7 years ago
How redeclaration of a?
Mayuu said:
7 years ago
@Ganesh yeah!
True. The default return type may be void.
True. The default return type may be void.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers