+ 1

Using a function in Main

I have a public non parameter function set up under my class. If I want to call the function in main what is and is not allowed ? Can I reuse same variable names and initialize them in main ? Thanks

11th Apr 2020, 5:49 PM
Marielle Macuil
Marielle Macuil - avatar
1 ответ
+ 1
In which language? Pls tag language also.. In c++: You can call those functions through objects.. Variables declared in a function are local variables, their scope is limited to function. Not available outside function. So you can declare with same name in main also.. It is better try it on playground and share that part of code if any error you get.. That makes easy for you to get your required answer.. Hoping it helps you..
11th Apr 2020, 8:38 PM
Jayakrishna 🇮🇳