0

why function initialisation [int main()] and variable defining [int sum;] are both the same command “int” ?

23rd Apr 2017, 12:47 PM
Azat Jorayev
Azat Jorayev - avatar
2 Respostas
+ 9
In int main(), int is return type of "main()" function. In int sum;, int is data type of "sum" variable.
23rd Apr 2017, 1:18 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
0
Int is not a command, it is a type (integer). In the main case, it must return an integer to send signals to the caller (usually the OS). In the variable case, it specifies how much memory should be allocated for that variable and how it will be read or written.
23rd Apr 2017, 2:34 PM
Denis Felipe
Denis Felipe - avatar