Now this is a silly puzzle I got from some exam paper,sadly I am unable to figure it out from last 15 minutes.
#include <stdio.h>
int main(void){
/* <something> */
putchar(*(wer[1]+1));
return 0;
}
What should we replace in place of something in order to get the output e.Now we know putchar takes a int as argument but this code assumes to give a pointer.Does this question is even valid ?
Since
a[i]is the same as*(a + i)by definition, you can transform theputchar()argument intower[1][1]. So, something likechar *wer[2]would be a satisfactory definition, and any values such thatwer[1][1] == 'e'will work.