1234567891011121314151617181920212223
#include <iostream> using namespace std; int main() { int tab[5] = { 1, 2, 4, 8, 16 }; int *p1 = tab, *p2 = tab + 4; for(int *p = p1 + 1; p < p2; p++) *p = p[-1] * 2; // line # 8 HERE! //cout << tab[1] << tab[2]; cout << "========================================" << endl; for(int *p = p1; p <= p2; p++) cout << *p << endl; *(p1 + 2) = 666; p1[1] = 100; cout << "========================================" << endl; for(int *p = p1; p <= p2; p++) cout << *p << endl; return 0; }
*p = p[-1]*2