Last Updated : 10 Apr, 2024
#include <iostream>
using namespace std;
  
int main() 
{ 
    char arr[] = {\'F\', \'o\', \'r\', \'k\', \'C\', \'P\', \'P\'};
    char arr1[] = {\'O\', \'n\', \'l\', \'i\', \'n\', \'e\', \'C\', \'o\', \'u\', \'r\', \'s\', \'e\'};
    char *ch = &arr[0]; // line 1
    char *ch1 = arr1;   // line 2
    cout << ch[0]<< ch[4] << ch[6] << endl;
    cout << ch1[0] << ch1[6];
  
   return 0; 
}  

The output for the above code is:
(A) FCP
OC
(B) Error in line 2
(C) FCP
Ce
(D) Error in line 1


Answer: (A)

Explanation:
arr and &arr[0] can be used interchangeably, both have same meaning. Similarly in the case of arr1 and &arr1[0]. An array name contains the address of first element of the array which acts like constant pointer.


Share your thoughts in the comments