+ 1

we cant define function before using it??

ex; int main() { printsomething();} void printsomething{ cout<<"hi hello"; } if it is any eror helpme plsss but how will answer correct if i use void first int last..

3rd Oct 2016, 2:17 PM
rahul negi
rahul negi - avatar
3 Réponses
+ 2
void printsomething(); int main { return 0; } void printsomething() { cout<<endl; }
3rd Oct 2016, 2:25 PM
Кирилл Зубарев
Кирилл Зубарев - avatar
+ 2
you must declare a "prototype" of the funtion before main so the compiler know that the funtion is defined after main. void printsomething(); //prototype int main(){} void printsomething(){ //definition here }
3rd Oct 2016, 2:34 PM
Hector Sulbaran
Hector Sulbaran - avatar
+ 1
what is it???
3rd Oct 2016, 2:33 PM
rahul negi
rahul negi - avatar