C语言-for循环步进长度可变

话不多说,上代码:

 for (ii = 0; ii < length; ii += this_write) 
    {
        this_write = min(LOAD_CHUNK, length - ii);
        if (mpu_write_mem(ii, this_write, (unsigned char*)&firmware[ii]))
            return -1;
        if (mpu_read_mem(ii, this_write, cur))
            return -1;
        if (memcmp(firmware+ii, cur, this_write))
            return -2;
    }

这是invense MPU DMP中的一段代码,for循环步进长度可变。比较少见记录一下

你可能感兴趣的:(经验学习,c语言)