Hello programming world.
I am currently doing my first programming course at university and our instructor said the function
int main (); //without the curly braces// is valid.
I may have misheard him/misinterpreted him, as when I try and run a console with that, it gives an error. But when I do int main() {}; it runs fine. So: 1. Are the curly braces needed regardless of the content in the body?
How did the function run without the return 0.
Using this, what is the shortest possible int main / void main function possible?
as requested, here is the error:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thank you so much :)