面试题答案
一键面试#include <iostream>
#include <cstdint>
void doubleRedChannel(uint8_t (*image)[3], int height, int width) {
for (int i = 0; i < height; ++i) {
for (int j = 0; j < width; ++j) {
uint8_t* pixel = &image[i][j][0];
int newRed = pixel[0] * 2;
pixel[0] = newRed > 255? 255 : newRed;
}
}
}