+ 1
Need help guys....if we declare a variable in any structure can we use those variables inside any fuction???
c language
5 Answers
+ 1
you have to declare it globally so that you can use it anywhere part of the program.
+ 2
The safer and cleaner way is to pass it as a parameter of the function, but you'll have to either pass its address or return it so that what you changed during the function call can be saved
+ 1
did you mean C# or c++? because c isnt on this app
+ 1
i guess it doesnt really matter which one as long as the struct is accessible and that what your trying to access in the struct is public(default in c++) then sure you can access it from any function
+ 1
No you cannot delcare anywhere and use it anywhere.