i have an array b[i] which stores the certain indices of another array a[i];both are integer arrays Is it possible to access it as a[b[i]]
#include <iostream>
using namespace std;
int main()
{
int k=0,v=0,i,b[10],c[10];
int a[]={1,2,3,4,5,6,7,8,9,10};
for(i=0;i<10;i++){
if(a[i]%2==0)
{b[k]=i; k++;}
}
for(i=0;i<10;i++)
{
c[v]=a[b[i]];
v++;
}
return 0;
}
results in segmentation fault