in c, is it possible to call a function inside another function which will be called by the main function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

in c, is it possible to call a function inside another function which will be called by the main function?

29th Jan 2019, 2:48 AM
Anoop
3 Answers
+ 7
Definitely! You can do it like this: #include <iostream> using namespace std; void bar() { cout << "hi!"; } void foo() { bar(); } int main() { foo(); return 0; }
29th Jan 2019, 3:04 AM
Rowsej
Rowsej - avatar
+ 7
Of course, the same thing which Rowsej did can be done in pure C language as well.
30th Jan 2019, 11:59 AM
Sonic
Sonic - avatar
+ 2
its exactly c++ not c
29th Jan 2019, 9:56 AM
esmaeel ensanimehr
esmaeel ensanimehr - avatar