Why function declaration is important. Here this program is running without declaration | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why function declaration is important. Here this program is running without declaration

void main() { int a; a=name(); } int name() { int b=7; return b; }

2nd Dec 2018, 3:05 AM
Amit Gupta
Amit Gupta - avatar
2 Answers
+ 1
In your code snippets there are two functions and both the functions are declared. Function declaration means stating the return type along with the function name,parenthesis, and body please be more specific about your doubt
2nd Dec 2018, 3:11 AM
Rishi Anand
Rishi Anand - avatar
0
My question is there is necessary to first declare a function. Because without declaration every program is running
2nd Dec 2018, 3:20 AM
Amit Gupta
Amit Gupta - avatar