94.7k views
5 votes
In the following program, if the first printf() statement prints 0x0256, what will be the output of the second printf() statement? 1: #include 2: 3: int main(void) 4: { 5: int i, array[5]; 6: 7: for (i = 0; i < 5; i++) 8: array[i] = i * 11; 9: 10: printf("%p\\", array); 11: printf("%d\\", (*array) + 2); 12: 13: return 0; 14: }

User JosMac
by
3.2k points

1 Answer

1 vote

Answer:

Output will be: 2

Step-by-step explanation:

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

int i, array[5];

for (i = 0; i < 5; i++)

array[i] = i * 11;

printf("%p\\", array); // it will print base address(memory address) of machine where array is stored

printf("%d\\", (*array) + 2); // it will print value at base address i.e. 0 in this case and add 2 in it

// then prints it.

return 0;

}

In the following program, if the first printf() statement prints 0x0256, what will-example-1
User Max Yari
by
3.2k points