#include <stdio.h>
int main(void) {
// Initialize the array correctly
int a[] = {1, 2, 3, 4, 5, 6, 7, 8};
int *p;
p = a; // Assign the address of the first element of the array to the pointer
printf("%d\n", p
[5]); // Print the sixth element (6) printf("%d\n", p
[0] + 1); // Print the first element + 1 (1 + 1 = 2) printf("%d\n", p
[2] + 2); // Print the third element + 2 (3 + 2 = 5)
p = &a[3]; // Assign the address of the fourth element of the array to the pointer
printf("%d\n", p
[3] + 1); // Print the seventh element + 1 (7 + 1 = 8) printf("%d\n", p
[4] + 1); // Print the eighth element + 1 (8 + 1 = 9)
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CiAgICAvLyBJbml0aWFsaXplIHRoZSBhcnJheSBjb3JyZWN0bHkKICAgIGludCBhW10gPSB7MSwgMiwgMywgNCwgNSwgNiwgNywgOH07CiAgICBpbnQgKnA7CiAgICBwID0gYTsgIC8vIEFzc2lnbiB0aGUgYWRkcmVzcyBvZiB0aGUgZmlyc3QgZWxlbWVudCBvZiB0aGUgYXJyYXkgdG8gdGhlIHBvaW50ZXIKCiAgICBwcmludGYoIiVkXG4iLCBwWzVdKTsgICAgICAgICAvLyBQcmludCB0aGUgc2l4dGggZWxlbWVudCAoNikKICAgIHByaW50ZigiJWRcbiIsIHBbMF0gKyAxKTsgICAgIC8vIFByaW50IHRoZSBmaXJzdCBlbGVtZW50ICsgMSAoMSArIDEgPSAyKQogICAgcHJpbnRmKCIlZFxuIiwgcFsyXSArIDIpOyAgICAgLy8gUHJpbnQgdGhlIHRoaXJkIGVsZW1lbnQgKyAyICgzICsgMiA9IDUpCgogICAgcCA9ICZhWzNdOyAgLy8gQXNzaWduIHRoZSBhZGRyZXNzIG9mIHRoZSBmb3VydGggZWxlbWVudCBvZiB0aGUgYXJyYXkgdG8gdGhlIHBvaW50ZXIKICAgIHByaW50ZigiJWRcbiIsIHBbM10gKyAxKTsgICAgIC8vIFByaW50IHRoZSBzZXZlbnRoIGVsZW1lbnQgKyAxICg3ICsgMSA9IDgpCiAgICBwcmludGYoIiVkXG4iLCBwWzRdICsgMSk7ICAgICAvLyBQcmludCB0aGUgZWlnaHRoIGVsZW1lbnQgKyAxICg4ICsgMSA9IDkpCgogICAgcmV0dXJuIDA7Cn0K