Determine Output:
void main()
      char s[]="man";
      int i;
      for(i=0; s[i]; i++)
            printf("%c%c%c%c ", s[i], *(s+i), *(i+s), i[s]);

A. mmm nnn aaa

B. mmmm nnnn aaaa

C. Compiler Error

D. None of These

Answer: Option D

Solution(By Examveda Team)

Correct Output : 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].

Join The Discussion

Comments ( 9 )

    10 months ago

    what is the name of the printed circuit board

  2. Pankaj Lakade
    Pankaj Lakade :
    2 years ago

    the ans is mmmm aaaa nnnn
    so option D is the correct..(none of these)

  3. Abhishek Singh
    Abhishek Singh :
    3 years ago

    Ans is Wrong.

  4. Shital Kanade
    Shital Kanade :
    3 years ago

    But answer will be mmmm aaaa nnnn

    3 years ago

    "mmmm aaaa nnnn "

  6. Ankush Sah
    Ankush Sah :
    3 years ago

    it output is "mmmm aaaa nnnn "

  7. Sonam Gaikwad
    Sonam Gaikwad :
    4 years ago

    answer is mmmm aaaa nnnn

  8. Vkp Kumar
    Vkp Kumar :
    4 years ago

    answer should be mmmm aaaa nnnn

  9. Jay Karan
    Jay Karan :
    4 years ago

    answer must be mmmm aaaa nnnn

Related Questions on C Miscellaneous