//============================================================== // Tablica;
// adres do tablicy. // arytmetyka adresowa. //
// ver data temat autor // 100 2001/10/11 Pierwszy projekt J. Malinowski // 101 2005/11/08 Cleanup JM // 102 2019/08/22 Cleanup JM //============================================================== #include <iostream> #include <math.h> using namespace std; //============================================================== int main(int argc, char *argv[])
{
int x[5] = { 1, 3, 5, 7, 9 }; // inicjalizacja tablicy; cout << "\n\nx = " << x << endl; int * px; px = x; cout << "px= " << px << endl; // Zawartosc tablicy:
cout << "\n\nZawartosc tablicy, m.in.:\n"; cout << "x[1] = " << x[1] << endl;
cout << "px[1]= " << px[1] << endl;
// A teraz zrobilismy blad:
cout << "\n\nA teraz zrobilismy blad:\n"; cout << " px+1 = " << px + 1 << endl; cout << " *px+1 = " << *px + 1 << endl; cout << "*(px+1)= " << *(px + 1) << endl; cout << "\n px+3 = " << px + 3 << endl; cout << " *px+3 = " << *px + 3 << endl; cout << "*(px+3)= " << *(px + 3) << endl; // system("PAUSE"); return 0; } //==============================================================