Display the resulting elements in the list


Discuss the below:

Q: Trace the following code, and display the resulting elements in the list:

int arr[] = (1, 2, 3, 4);
int arrSize = sizeof(arr)/sizeof(int);
list intList(arr, arr+arrSize);
list::iterator iter = intList.begin();
int i;

for (i=1; i <= arrSize; i++)
intList.insert(iter++, i);

 

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Display the resulting elements in the list
Reference No:- TGS01937558

Now Priced at $20 (50% Discount)

Recommended (96%)

Rated (4.8/5)