+ 2

Are function starting without the key word "function" ?

hi, what is the difference between a function with the WORD function (if there is ???) and a function without the word function , starting with int b () { }; ?

23rd Jun 2018, 6:48 PM
S. Kaouche
S. Kaouche - avatar
4 Respuestas
+ 4
In c++ dont exist a keyword for identify functions
23rd Jun 2018, 8:18 PM
KrOW
KrOW - avatar
+ 1
function is just a name or keyword or you can say identifier. there is no difference between function name as b and function . but you should give valid name as it gives good look to coding.
23rd Jun 2018, 7:58 PM
कामेश
कामेश - avatar
+ 1
no I don't th
23rd Jun 2018, 8:18 PM
कामेश
कामेश - avatar
+ 1
there is no keyword in c++ for defining functions. but there are other ways of defining function-like objects in c++ that are not covered in the sololearn tutorial, such as lambdas and function objects. the difference between a function and a lambda is that a lambda can bind variables that are in scope, whilst a function can‘t(maybe i‘m wrong and c++ is doing weird stuff, so please correct me if i‘m wrong). there are also so called function objects that are objects that overload the () operator and those are also strange. all of these objects can be stored in the type std::function.
23rd Jun 2018, 8:49 PM
Max
Max - avatar