Write a program to show a use case of a reference variable to an array.
#include<iostream> using namespace std; int main() { int a[5] = {11,22,33,44,55}; int (&p)[5] = a; for(int i = 0; i < 5;i++) { cout << "p[" << i << "] = " << p[i] << endl; } return 0; }
Output
p[0] = 11 p[1] = 22 p[2] = 33 p[3] = 44 p[4] = 55