CPP

CPP

Pointers into Arrays has 6 Questions

What is meaning of following declaration? int(*p[5])();

p is pointer to function.
p is array of pointer to function.
p is pointer to such function which return type is array.
p is pointer to array of function.
What is size of generic pointer in C++ (in 32-bit platform) ?

2
4
8
0
What is the output of this program?
  1.    #include 
  2.    using namespace std;
  3.    int main()
  4.    {
  5.        int a[2][4] = {3, 6, 9, 12, 15, 18, 21, 24};
  6.        cout << *(a[1] + 2) << *(*(a + 1) + 2) << 2[1[a]];
  7.        return 0;
  8.    }

15 18 21
21 21 21
24 24 24
Compile time error
What is the output of this program?
  1.    #include 
  2.    using namespace std;
  3.    int main()
  4.    {
  5.        int i;
  6.        char *arr[] = {"C", "C++", "Java", "VBA"};
  7.        char *(*ptr)[4] = &arr;
  8.        cout << ++(*ptr)[2];
  9.        return 0;
  10.    }

ava
java
c++
compile time error
What is the output of this program?
  1.    #include 
  2.    using namespace std;
  3.    int main()
  4.    {
  5.        int arr[] = {4, 5, 6, 7};
  6.        int *p = (arr + 1);
  7.        cout << *p;
  8.        return 0;
  9.    }

4
5
6
7
What is the output of this program?
  1.    #include 
  2.    using namespace std;
  3.    int main()
  4.    {
  5.        int arr[] = {4, 5, 6, 7};
  6.        int *p = (arr + 1);
  7.        cout << arr;
  8.        return 0;
  9.    }

4
5
address of arr
7