0

Does anybody know on which version of C this code will not throw compilation error ?

#include <stdio.h>

int main(){
    int y;
    y = f();
}

As per my knowledge of C programming language this code should not compile. Since a function must not exist without it's definition. But, my teacher said the above code should compile in C language and it will throw error at run time. She also suggest that C compilers check for the definition at the run time.

I had tried on C90 and C99 environment in Codeblock with GCC compiler, but result was compile time error as i presumed.

Help me out with this mess. -> When does a C compiler check for definition of program ? -> Does above code is possible to pass through compilation process and throw error at run time in any old version of C or any older C compiler. -> Suggest me if i have some misconceptions.

Thanks for helping me out.

lifeisshubh
  • 513
  • 1
  • 5
  • 27

0 Answers0