+ 5
How does this output comes? In C
Please help me to understand how does this output comes.... And also tell me, how it was working.... Here that code..... https://code.sololearn.com/cIk4gM5PPF1u/?ref=app https://code.sololearn.com/cIk4gM5PPF1u/?ref=app
5 Respostas
+ 6
p[2] can be referred to as *(p+2)
+ 10
You initialised an array and a pointer to store the address of integer variable.
By using * operator we can access the value of a variable through a pointer.
In your printf statement you accessed the value of address 2 of a[p] would give us the value of the variable stored in address 2 subsequently.
Thus the answer comes out as 2.
+ 5
Interesting! As Arsenic said, it seems that, by ommiting the *, it can reference the entire array instead. It also seems that the arrays a and p are linked, so if you do a[2] = 42 in the line before the printf statement, it will output 42.
+ 4
Thanks to all....😊🙏
+ 3
an array name is a pointer itself, it points to the first element address, and to other elements as you increment it.