C++ main function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C++ main function

Does C++ support more data types on main function? (Like strings, doubles and int32_t)

17th Dec 2023, 7:06 AM
Mohammad Hossein Kasirloo
Mohammad Hossein Kasirloo - avatar
3 Answers
+ 5
what you put inside main is what is important. no need to change main's return type. It is just the entry point.
17th Dec 2023, 9:58 AM
Bob_Li
Bob_Li - avatar
+ 4
If you want to work with data types like strings, doubles, and int32_t within your program, you can use these data types inside the function body. However, when dealing with command-line arguments, they are initially passed as strings, and you may need to convert them to the desired types based on your program's logic
18th Dec 2023, 10:40 AM
Ayush Singh
Ayush Singh - avatar
+ 2
Bob_Li no it does affects when u need bigger than 32bit integers and u feel tedious to type long long everywhere or even a shorter macro for it better u change int to long long as macro and also return type of main from int to int32_t becomes a necessity
31st Dec 2023, 4:10 AM
Manuphile
Manuphile - avatar