Код: Выделить всё
// Declaring a variable:
int* buf = new int[max_size];
// Filling in the data:
for (int i = 0; i < max_size; ++i) buf[i] += i;
// We pass it to the function:
process(&buf);
Код: Выделить всё
void process(const int* const* buf)
{
int a = 0;
int ch = 1;
for(int c = 0; c < ch; ++c)
for (int i = 0; i < max_size; ++i)
a += buf[c][i]; // ???
}
Код: Выделить всё
a += buf[c][i];P S:
Я думаю, это потому, что здесь &but мы передаем адрес части const float* const* buf.
Но, может быть, этому есть более академическое объяснение?
Подробнее здесь: https://stackoverflow.com/questions/791 ... to-pointer
Мобильная версия