I want to compile this code:
void function () { puts("Hello world"); } main = function; In some places, it compiles , but when executed it falls with an error, in places it does not compile :
prog.c:5:1: error: initializer element is not computable at load time main = function; ^
How to make it compile, run and not fall at least somewhere?
http://ideone.com/BZMp2V - changing void to int and adding return 0 does not help:
int function () { puts("Hello world"); return 0; } main = function; On ideone, programs are 32-bit , so the pointer to the implicit int is also not associated with a custom pointer.
for = while;... :) By the way, you can compile if you declaremainas a function pointer. VC does not even swear at the absence of an entry point. But it falls ... - Harrymain=. - Qwertiy ♦prog.c:5:1: warning: 'main' is usually a function [-Wmain]- I draw attention to the word usually - that is, usually, but not always. - Qwertiy ♦