Data-Type
November 15, 2023
Computer-Networks
November 15, 2023
Data-Type
November 15, 2023
Computer-Networks
November 15, 2023

Question 1277 – Compilation

What error would the following function given on compilation?
f(int a, int b)
{
int a;
a=20;
return a;
}

Correct Answer: C

Question 1 Explanation: 
We are already declared variable name ‘a’ in function. Again we are declared inside the function. So, the compiler will raise a error “Redeclaration of a”
A
Missing parenthesis is return statement
B
Function should be defined as int f(int a, int b)
C
Redeclaration of a
D
None of these

Leave a Reply

Your email address will not be published. Required fields are marked *