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

Post New Answer

More C Code Interview Questions

what will be the position of the file marker? a: fseek(ptr,0,SEEK_SET); b: fseek(ptr,0,SEEK_CUR);

2 Answers  


void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }

2 Answers  


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

1 Answers  


hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?

6 Answers  


main() { char not; not=!2; printf("%d",not); }

1 Answers  






What is full form of PEPSI

0 Answers  


what is brs test reply me email me kashifabbas514@gmail.com

0 Answers  


What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }

1 Answers  


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

0 Answers   Mbarara University of Science and Technology,


why java is platform independent?

13 Answers   Wipro,


void main() { int c; c=printf("Hello world"); printf("\n%d",c); }

2 Answers  


int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }

2 Answers   CSC,


Categories