Consider the following C program: double foo (double); /* Line 1 */ int main()…

PYQ GATE 2005

Consider the following C program:

double foo (double); /* Line 1 */

int main()
{

    double da, db;

    // input da

    db = foo(da);

}

double foo(double a)
{
    return a;
}

Assume the program is compiled in ISO C17 mode with GCC 14 or later, or Clang 16 or later, using default diagnostic severity. If Line 1 is deleted, which result best describes the compilation?

  1. A.

    no compile warning or error

  2. B.

    some compiler warnings not leading to unintended results

  3. C.

    some compiler warnings due to a type mismatch, eventually leading to unintended results

  4. D.

    compilation fails with compiler errors

Attempted by 635 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…