Ask Question
17 July, 15:32

Which of the following declarations for a function is valid and legal in C++?

Select one:

a. void foo

b. All of the choices listed are valid C+ + function declarations

c. int foo (char x);

d. None of the choices listed is a valid C+ + function declaration

e. foo (int a, int b);

+2
Answers (1)
  1. 17 July, 17:02
    0
    c. int foo (char x);

    Explanation:

    Among the given options:

    int foo (char x);

    is a valid function declaration which declares a function with the name foo which takes a single character argument x and returns an integer data type.

    Option a (void foo) does not specify the arguments off the function while option e (foo (int a, int b); ) does not specify the return type. Hence these are incomplete function declarations.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Which of the following declarations for a function is valid and legal in C++? Select one: a. void foo b. All of the choices listed are ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers