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..

Answer / susie

Answer :

mmmm

aaaa

nnnn

Explanation:

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].

Is This Answer Correct ?    37 Yes 7 No

Post New Answer

More C Code Interview Questions

why array index always strats wuth zero?

2 Answers  


‎#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }

2 Answers  


Link list in reverse order.

8 Answers   NetApp,


C program to print magic square of order n where n > 3 and n is odd

2 Answers   Accenture,


Write a routine that prints out a 2-D array in spiral order

3 Answers   Microsoft,






WAP to display 1,2,3,4,5........N

2 Answers  


main(int argc, char **argv) { printf("enter the character"); getchar(); sum(argv[1],argv[2]); } sum(num1,num2) int num1,num2; { return num1+num2; }

1 Answers  


Derive expression for converting RGB color parameters to HSV values

1 Answers  


Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

1 Answers  


#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }

1 Answers  


What is "far" and "near" pointers in "c"...?

3 Answers  


void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(ā€œ%dā€,k); }

1 Answers  


Categories