title: trouble in passing structure literal as function parameter
body: <p>Please have a look at this program</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  
  typedef struct hs_ims_msrp_authority
  {
     int     host_type;
     char    buf[50];
     int     port;
  }hs_i;
  
  int main()
  {
   char dom[50];
   int i = 10, j = 20;
   strcpy(dom, "ine");
   fun((hs_i){i, dom, j});   // doesnt work
   fun((hs_i){i, "dom", j}); // this works
  }
  
  int fun(hs_i c)
  {
   printf("%d %s %d\n", c.host_type, c.buf, c.port);
  }
  </code></pre>
  
  <p>In call to fun function in main; how come function call work when string literal ("dom") is passed where as when array variable (dom) is passed it doesnt work?</p>
  
  <p>To make variable work should it be typecasted in a specific way? or is there any other way?</p>