in Programming in C
580 views
2 votes
2 votes

#include <stdio.h>
char *c[] = {"GatsQuiz", "MCQ", "TEST", "QUIZ"};
char **cp[] = {c+3, c+2, c+1, c};
char ***cpp = cp;
int main()
{

printf("%s ", **++cpp);
printf("%s ", *--*++cpp+3);
printf("%s ", *cpp[-2]+3);
printf("%s ", cpp[-1][-1]+1);
return 0;

}

what is the output of this program? Please explain with reasons.

in Programming in C
580 views

2 Comments

1
1

Useful link @Satbir

0
0

1 Answer

3 votes
3 votes
Best answer

Based on the precedence of operators, given in https://en.cppreference.com/w/c/language/operator_precedence

Assuming size of pointer takes 8 Bytes, and Character takes 1 Byte.


we can evaluate the expressions in the program as follows:

selected by

Related questions