can i use Twinkle() instead of main()? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

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

13th Sep 2016, 2:45 PM
Twinkle Baisane
Twinkle Baisane - avatar
5 Respostas
+ 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