Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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);

}



main ( ) { static char *s[ ] = {“black”, “white”, “yellow”, “viol..

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 ?    4 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { int (*functable[2])(char *format, ...) ={printf, scanf}; int i = 100; (*functable[0])("%d", i); (*functable[1])("%d", i); (*functable[1])("%d", i); (*functable[0])("%d", &i); } a. 100, Runtime error. b. 100, Random number, Random number, Random number. c. Compile error d. 100, Random number

1 Answers   HCL, rsystems,


#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }

2 Answers  


Give a oneline C expression to test whether a number is a power of 2?

25 Answers   EA Electronic Arts, Google, Motorola,


void main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d",(int*)*v); }

1 Answers   Honeywell,


Given n nodes. Find the number of different structural binary trees that can be formed using the nodes.

16 Answers   Aricent, Cisco, Directi, Qualcomm,






void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }

1 Answers  


Cau u say the output....?

1 Answers  


All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,


print a semicolon using Cprogram without using a semicolon any where in the C code in ur program!!

34 Answers   Tata Elxsi, TCS, VI eTrans,


Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])

1 Answers  


Is it possible to print a name without using commas, double quotes,semi-colons?

7 Answers  


#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 Answers  


Categories