Please explain how does this code work... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please explain how does this code work...

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

28th Jun 2020, 3:26 PM
SAURAV KUMAR
SAURAV KUMAR - avatar
6 Answers
+ 1
In you code...your not incrementing the actual pointer....(as in p++)...you are post/pre incrementing the the value it's pointing to .....p[0].
28th Jun 2020, 3:38 PM
rodwynnejones
rodwynnejones - avatar
+ 1
well there is this pointer p pointing on arr[0] starting with 25. Then 8 times a[0] is increased and printed then a newline is printed and then 7 times a[0] is printed and AFTERWARDS increased. More is not really happening. If there are further questions or issues feel free to specify your question...
28th Jun 2020, 3:32 PM
Alexander Thiem
Alexander Thiem - avatar
+ 1
How this statement is working *++p
28th Jun 2020, 4:03 PM
SAURAV KUMAR
SAURAV KUMAR - avatar
+ 1
*++p increases the pointer, so if p was a[0] it will be a[1] after that and then reads what stands at the position p i pointing to
28th Jun 2020, 5:17 PM
Alexander Thiem
Alexander Thiem - avatar
+ 1
You are welcome
28th Jun 2020, 5:39 PM
Alexander Thiem
Alexander Thiem - avatar
0
Thank you so much...🤗
28th Jun 2020, 5:37 PM
SAURAV KUMAR
SAURAV KUMAR - avatar