0
#include<conio.h>
#include<stdio.h>
void main()
{
    int i=0;
    char s[]={"this is string"};
    while(s[i]!=0)
    {
        printf("%c",i[s]);
        i++;
    }
}

This Program does not give error and produce output as "this is string". why..??

3
  • 4
    s[i] and i[s] are same as *(s + i). Commented Apr 27, 2017 at 11:39
  • 1
    Short answer: don't write weird crap like that and you don't have to worry about why it works. Knowing that you can change the place of the s and i is useless knowledge. Commented Apr 27, 2017 at 11:49
  • Please format your code (like in your C textbook). Commented Apr 27, 2017 at 12:20

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.