1,826 views
4 4 votes
#include <stdio.h>
char *str[]={"FirstSring","Is","Already","Written"};
char **strp[]={str+3,str+2,str+1,str};
char ***strpp=strp;
int main(void) 
{
        printf("%s",**++strpp);
        printf("%s",*--*++strpp+3);
        return 0;
}

Output of this, and the interpretation?

1 Answer

Best answer
8 8 votes
#include <stdio.h>

char *str[]={"FirstString","Is","Already","Written"};
// str is an array of char pointers
char **strp[]={str+3,str+2,str+1,str};
// strp is an array of pointers and those pointers point to char
// simply strp is array of pointers
char ***strpp=strp;
// strpp is pointer variable which store address of another pointer

int main(void)  {
		printf("%s",**++strpp); // Already
		
		printf("%s",*--*++strpp+3); //stString

		// (*(--(*(++strpp))))+3 
		// ++ has higher precedence than binary +
		// * has higher precedence than binary +
		// -- has higher precedence than binary +
		
		return 0;
}
// final OP : AlreadystString

Now, Assuming character takes 1 Byte and pointer variable takes 4 Bytes.

  1. char *p ; increment on p will take place in $1$ Byte step
  2. char **p (Or, any double pointer): increment will take place in $4$ Byte step.

• edited by
Position:
Show:

Related questions

9 9 votes
6 6 answers
1.0k
1.0k views
GO Classes asked Jul 25, 2025
1,003 views
#include <stdio.h void fun() { static int count = 0; count++; printf("%d ", count); } int main() { for (int i = 0; i < 3; i++) fun(); return 0; }What is the output of the...
6 6 votes
3 3 answers
698
698 views
GO Classes asked Jul 25, 2025
698 views
Given the pseudocode below for the function remains(), which of the following statements is true about the output, if we pass it a positive integer $n>2$ ? int remains(in...
7 7 votes
4 4 answers
764
764 views
GO Classes asked Jul 19, 2025
764 views
int arr[ ]={1, 2, 3, 4} int count; incr( ) {return ++count;} main( ) { arr[count++]=incr( ); printf("arr[count]=%d\n", arr[count]); }The value printed by the above progra...