It prints some weird char but when I use printf("%s", a);
It prints the char array normally , why is that? why does a refer to the entire array rather than the first element like char *p = a; this refers to the first element of the array i suppose why isnt it the same?
a is the address in memory of an array of characters. When you try to print a as a character, you end up taking the lower order byte of the address and treating that as a character. If a happens to be at an address in which the lower order byte is meaningful as a character, that's what you'll get. If not, you'll get garbage.