I'm trying to jump from an element to another element with a specified number for jumping and how many times it jumps, for example, k=4, and if it reaches the end it goes back from where it started. For example, as in the code, the array for a[Max] will be like {1,4,7,1}
#define Max 100
int main() {
   int i=0,n,k,counter,j=0;
   char v[Max]={1,2,3,4,5,6,7,8};
   int a[Max];
   k=4;
   counter=k+1;
   int size=strlen(v);
   while(counter!=0) {
       for(i=0;i<size;i=i+k-1){
           a[j]=(int)v[i];
           j++;
           counter--;
       }
   }
}
 
    