How I can index the array starting from 1 instead of zero?

后端 未结 5 1017
滥情空心
滥情空心 2020-12-10 09:46
for (int i = 0; i < reports.length; i++) {

  Products[] products = reports[i].getDecisions;

  for (int j = 0; j < products.length; j++) {

  }
}
5条回答
  •  孤街浪徒
    2020-12-10 10:17

    You can use pointers, to jump to a certain point of the array and start the array from there.

    For example:

    char str[20];
    str={'H', 'E' ,'L' ,'L', 'O','W' ,'O ','R','L',' D'};
    char *ptr;
    *ptr=str[0];
    //right now its pointing to the starting.
    ptr=ptr+3;
    //Now pointing at 3rd unit.
    

    This doesn't work in every compiler.This is the closest thing that can be done for your question.

提交回复
热议问题