title: Why printf("%s",(char[]){'H','i','\0'}) works as printf("%s","Hi"), but printf("%s",(char*){'H','i','\0'}); fails?
body: <p>I really need help on this.It has shaken my very foundation in C.Long and detailed answers will be very much appreciated.I have divided my question into two parts.</p>
  
  <p><strong>A:</strong> Why does <code>printf("%s",(char[]){'H','i','\0'});</code> work and prints <code>Hi</code> just as the conventional <code>printf("%s","Hi");</code> does?Can we use <code>(char[]){'H','i','\0'}</code> as a substitute for <code>"Hi"</code> anywhere in our C code?Do they mean the same?I mean,when we write <code>"Hi"</code> in C,it generally means <code>Hi</code> is stored somewhere in memory and a pointer to it is passed.Can the same be said of the seemingly ugly <code>(char[]){'H','i','\0'}</code>.Are they <strong>exactly</strong> same?</p>
  
  <p><strong>B:</strong> When <code>printf("%s",(char[]){'H','i','\0'})</code> works successfully,the same as <code>printf("%s","Hi")</code>,why then <code>printf("%s",(char*){'A','B','\0'}</code> fails big time and seg-faults if I run it despite the warnings? It just amazes me, because ,in C, isn't <code>char[]</code> supposed to decompose into <code>char*</code> ,like when we pass it in function arguments,why then it is not doing so here and <code>char*</code> gives failure?I mean, isn't passing <code>char demo[]</code> as an argument to a function same as <code>char demo*</code>?Why then the results are not same here?</p>
  
  <p>Please help me out on this.I feel like I haven't even yet understood the very basics of C.I am very disappointed.Thank you!!</p>