Which of the following statements is/are true?
(1)Function declaration specifies the return type of function and types of parameters it will accept.
(2)Variable declared in a function is also available for the other functions.
(3) Function definition defines the task of main program.
-
Only (1)
-
Only (2)
-
Only (3)
-
Both (1) & (2)
-
Both (2) & (3)
A
Correct answer
Explanation
Function declaration no doubt specifies return type and parameters of function. So, statement (1) is correct.
Variable declared in a function is unique. So, it cannot be used by another function. So, statement (2) is false.
Rules of function allow us to declare as many functions in a program as we want. So, statement (3) is incorrect.
Hence, only statement (2) is correct.