-1
#include<stdio.h>
main()
{
  printf("%c\n",1-3+2["nexus"]);
}

The result is v. How does it turn out?
What does the indentation (square ones) do?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Fenris
  • 45
  • 2
  • 6
  • What did you expect? Please also reduce your example, as you probably don't need the `1-3+` part to affect the expectations. – Cœur Mar 13 '18 at 05:23
  • @Cœur, just to let you know, I didn't DV your last question. I just marked it. (I don't dv, I just try and help) – David C. Rankin Mar 13 '18 at 07:20
  • @DavidC.Rankin I appreciate your help. But I feel bad about the downvotes I got after all the time I spent searching for "square brackets syntax" and "square brackets notation". – Cœur Mar 13 '18 at 07:52
  • Yes, just shake them off, they come out in the wash. It used to get under my skin when the downvote weenies would run by without having the integrity to leave a comment, but in the end, it's just 2-points, and there are some people that just feel superior by being able to hit the down button. Just make sure you set a better example. That's all we can do. (and things have gotten better -- it now costs the downvoter 1-point to downvote, so they are not nearly as willy nilly as they were in the past) – David C. Rankin Mar 13 '18 at 07:57

2 Answers2

0

2["nexus"] is probably leading us to 3 element of the nexus considering it as an array of characters[arr[2]=x in our case]

following is 1-3viz -2 added to x character ie added to to ascii value and the corresponding element is v

cant exactly figure out what the square identation really mean but according to the oput this is possible way .

Fenris
  • 45
  • 2
  • 6
0

2["nexus"] is same as "nexus"[2], which correspond to the 2nd index or the 3rd element of this string. ( Which is 'x' here ).

In equation, 1-3+ 2["nexux"] is like 1-3+'x' that represent 'v'.

Note

When a string is declared like "nexus".

nexus[0] is 'n'
nexus[1] is 'e'
nexus[2] is 'x'
nexus[3] is 'u'
nexus[4] is 's'
Sandeep_black
  • 1,352
  • 17
  • 18