main() { char s[ ] = "man"; int i; for( i=0; s[ i ]; i++) printf( "n%c%c%c%c", s[ i ], *(s+i), *(i+s), i[s] ); }

main() { char s[ ] = "man"; int i; for( i=0; s[ i ]; i++) printf( "n%c%c%c%c", s[ i ], *(s+i), *(i+s), i[s] ); } Correct Answer mmmm aaaa nnnn

s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea.Generally array name is the base address for that array. Here s is the base address. i is the index number/displacement from the base address. So, indirecting it with * is same as s[i]. i[s] may be surprising. But in the case of C it is same as s[i].

Related Questions

Determine output:
#include void main(){ char *p = NULL; char *q = 0; if(p) printf(" p "); else printf("nullp"); if(q) printf("q"); else printf(" nullq");}
Comment on the output of the following C code.
#include int main(){ int a = 1; switch (a) case 1: printf("%d", a); case 2: printf("%d", a); case 3: printf("%d", a); default: printf("%d", a);}
Comment on the following 2 C programs.
#include  //Program 1int main(){ int a; int b; int c;}#include  //Program 2int main(){ int a; { int b; } { int c; }}