Since c++11 you can use begin and end free function. Both of them work on both standard containers and "c arrays". And since we also have auto
in c++11 you can rewrite your code as follows:
// Common algorithm using both implementation
auto it1 = std::begin(adj[0]);
for(int i = 0; i < degree[0]; i++)
cout << *it1++;
auto it2 = std::begin(adj2[0]);
for(int i = 0; i < degree[0]; i++)
cout << *it2++;