0

1["abc"]

Could anyone tells me what's the name of this code style in C++

27th Jul 2018, 10:58 AM
Outro
Outro - avatar
5 Answers
+ 2
I guess this is one of the challenge question... if I am not mistaken, it is like below: this is used with cout and output expected is b... now, let me try to explain this output... "abc" is string, which inturn as array of character... now, recall array as pointer.... so, here we are trying to get second element of array "abc" ...HIH
27th Jul 2018, 1:13 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 3
Dark Angel A challenge question says "What does it output cout<<1["abc"]"
27th Jul 2018, 1:20 PM
Outro
Outro - avatar
+ 2
I need more details so that I can help you.
27th Jul 2018, 12:01 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
Ketan Lalcheta I gave a right answer in that question. But I hadn't seen it before
27th Jul 2018, 1:22 PM
Outro
Outro - avatar
0
x[i] is the same as *(x + i), so you are just interchanging the x with the i. note that x must be a pointer(which a number implicitly is)
27th Jul 2018, 5:55 PM
Bebida Roja
Bebida Roja - avatar