We are developing a C++ project with 10 cpp files and 3 header files.We are declared array structure of 3 integer varibles globaly in header file and using in some files and where arrays are updated ,re-adjusted in some cpp files and use in another files.Project is running fine but we wish to use vector structure because dynamic allocation ,easy resize.
How to replace array structure to vector structure ?
How to make a vector structure globaly ?
Put the vector in a global area, then declare it as extern in all the other files that need to use it.
Although it would probably be better just to pass it around as a function parameter or something. If you have a bunch of globals, throw them all into a structure and pass that around (or at least try to combine the relevant variables).