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

GATE · 2005 · CS

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 521 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…