+ 1

can i use Twinkle() instead of main()?

13th Sep 2016, 2:45 PM
Twinkle Baisane
Twinkle Baisane - avatar
5 Respuestas
+ 3
#include<iostream> using namespace std; #define Twinkle main   int Twinkle() {    cout<<"Hello";    return 0; } run this code in g++ compiler
13th Sep 2016, 2:54 PM
Twinkle Baisane
Twinkle Baisane - avatar
+ 1
Touché. That's still main() once your code is compiled though.
13th Sep 2016, 3:07 PM
Zen
Zen - avatar
+ 1
but i can write twinkle()
13th Sep 2016, 3:09 PM
Twinkle Baisane
Twinkle Baisane - avatar
0
No, the function that your program execute first is always main(). You can have a Twinkle() function however.
13th Sep 2016, 2:54 PM
Zen
Zen - avatar
0
You shall have a main function for a valid program but you can avoid its direct use by preprocessor macros.
13th Sep 2016, 6:15 PM
Simant |Kingpin|
Simant |Kingpin| - avatar