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 and easy resize.

How to replace array structure to vector structure ?
How to make a vector structure globaly ?

please help us .....

Thanks
Rajeev

Simply declare the vector globally as yoiu would a normal global variable. The add the values you require to the vector using one of the methods availlable to vectors, e.g. push_back(). After that you shouldn't need to do anything. As a vector supports the subscript operator the rest of your code should be able to stay as it was for the array.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.