char a[20]=“codechef”;

//what is the output?

First of all your code won’t compile, because you have declared ‘a’ as char and used as ‘int’ in printf()
expecting as ‘%s’ instead of ‘%d’ in printf() your out put is simply “codechef” (with out quotes) even though length of “codechef” is not 20.

its compiling fine and giving in the output a very large number!