2D vector data types should be different or same only ..
for ex::
for one sub script with int data type and with another subscript with class name is it possible to declare with diff. data types
narlapavan 0 Newbie Poster
Recommended Answers
Jump to PostYes, the vector can hold items of random data types
#include <vector> #include <string> int main() { int a = 0; float b = 1.2F; std::string hello = "Hello"; std::vector<void*> list; list.push_back(&a); list.push_back(&b); list.push_back(&hello); }
All 4 Replies
arkoenig 340 Practically a Master Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
narlapavan 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
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.