Answers for "use of auto in C++"

C++
2

auto in cpp

#include<iostream>
#incllude<vector>
using namespace std;

int main() {
   vector<int> vec(10);       // Auto deduce type to be iterator of a vector of ints.
   for(auto it = vec.begin(); it != vec.end(); vec ++)
   {
      cin >> *it;
   }
   return 0;
}
Posted by: Guest on December-09-2020
0

for auto c++

for (auto&& [first,second] : mymap) {
    // use first and second
}
Posted by: Guest on October-14-2021

Browse Popular Code Answers by Language