How can I make a global function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I make a global function?

I have a situation that I have to put a function inside and I want the code inside the function accessible to other functions. How can I do that? PS: I searched the discussions and there were some results but when I looked at them, it was still confusing.

24th Sep 2020, 12:24 AM
:DD
:DD - avatar
4 Answers
+ 1
Taehodz :D a nested function can a be accessed by the other functions as well.
24th Sep 2020, 1:42 AM
BroFar
BroFar - avatar
+ 1
You have to declare external storage class with "extern" keyword.
24th Sep 2020, 2:50 AM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar
+ 1
Thank you, everyone :)
25th Sep 2020, 2:56 PM
:DD
:DD - avatar
0
We can create global function by writing function outside the main function or we can say that you have to declare function in class and then call that function inside the class
24th Sep 2020, 5:15 PM
Twinkle Baisane
Twinkle Baisane - avatar