Printing array[array[i]]

if we have given an array of suppose size 5 and elements of array are;
input: 1 3 2 5 4
output : 3 5 2 6 4
means we need to find array[array[i]]:

but when I print it directly array[array[i]] without copying to temp array shows error/run time error .
please help me with this.

hello @manish99

in input u need to give values only in range [0…n-1]
because u r using them as index

if we have given an array of suppose size 4 and elements of array are;
input: 1 3 2 0
output : 3 0 2 1
means we need to find array[array[i]]:

but when I print it directly array[array[i]] without copying to temp array shows error/run time error .
please help me with this.

pls save ur code at cb ide and share it link with me

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.