+ 3

Please explain the output of the attached code.

https://code.sololearn.com/crgCxEKuE3z9/?ref=app

26th Aug 2020, 3:42 AM
[ ]
[     ] - avatar
5 Respuestas
+ 5
ptr1 = (ptr += sizeof(int))[-2]; in this line you first step forward 4 times in the array and then come back 2 times it seems to be: ptr1 = ptr[2]; or ptr1 = &(ptr + 2); so ptr1 is equal to third member of the array i.e "cat"
26th Aug 2020, 4:13 AM
Mahdi Salmani
Mahdi Salmani - avatar
+ 4
I think you should revise the course! There are many mistakes https://www.sololearn.com/Course/C/?ref=app
26th Aug 2020, 3:48 AM
Namit Jain
Namit Jain - avatar
+ 2
Mahdi Salmani thank you so much.....u helped me.....instead of lecturing me for uploading wrong code (which I did accidentally)......lol thank you so much.
26th Aug 2020, 4:19 AM
[ ]
[     ] - avatar
+ 2
you'r welcome :)
26th Aug 2020, 4:21 AM
Mahdi Salmani
Mahdi Salmani - avatar
+ 1
Namit Jain I corrected the code, sorry I didn't checked my code before uploading....can u explain me now!?
26th Aug 2020, 3:55 AM
[ ]
[     ] - avatar