main ( )
{
static char *s[ ] = {“black”, “white”, “yellow”,
“violet”};
char **ptr[ ] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
**++p;
printf(“%s”,*--*++p + 3);
}
Answer / susie
Answer :
ck
Explanation:
In this problem we have an array of char pointers pointing
to start of 4 strings. Then we have ptr which is a pointer
to a pointer of type char and a variable p which is a
pointer to a pointer to a pointer of type char. p hold the
initial value of ptr, i.e. p = s+3. The next statement
increment value in p by 1 , thus now value of p = s+2. In
the printf statement the expression is evaluated *++p causes
gets value s+1 then the pre decrement is executed and we get
s+1 – 1 = s . the indirection operator now gets the value
from the array of s and adds 3 to the starting address. The
string is printed starting from this position. Thus, the
output is ‘ck’.
Is This Answer Correct ? | 5 Yes | 0 No |
main() { clrscr(); } clrscr();
typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }
/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }
Under linux environment can u please provide a c code for computing sum of series 1-2+3-4+5......n terms and -1+2-3+4-5...n terms..
int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.
2 Answers Bosch, eInfochips, HCL, IHCL,
write a program to find out roots of quadratic equation "x=-b+-(b^2-4ac0^-1/2/2a"
main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }
void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }
Finding a number which was log of base 2
why array index always strats wuth zero?
main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }
#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }