I'm writing some C++ code
And I found a very strange thing
Like below code, it works well even though a function's declaration and definition are different
Does anyone know how can this is possible?
build cmd : g++ main.cpp foo.cpp
// main.cpp
#include <iostream>
char foo();
int main() {
foo();
}
// foo.cpp
#include <iostream>
void foo() {
std::cout << "I'm foo"<< std::endl;
}