I
I
Ivan Gromov2015-09-30 01:12:16
C++ / C#
Ivan Gromov, 2015-09-30 01:12:16

How does this variable definition work?

Recently I came across an interesting definition of a variable in the C language:
char c = 2["abcdf"]
To my surprise, the value 'c' was written to the variable c. Could someone explain how this works (not just a guess, I figured out how it happened myself). Namely, to explain what such a definition is called, why it works, where you can read more about such definitions or similar interesting features of the c / c ++ language

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OnYourLips, 2015-09-30
@riivers

address arithmetic.
i[A] == *(A+i) == A[i].

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question