title: How to scan a string with white spaces in structure members in C?
body: <pre><code>struct Demo{
     char a[50];
     char b[50];
     int a;
  };
  </code></pre>
  
  <ul>
  <li><p>Can anyone give the code for this structure Demo where a and b will contains string with different words[white-spaces].</p>
  
  <p>I tried </p>
  
  <ul>
  <li><code>scanf("[^\n]s",name.a); //where name is the object</code></li>
  <li><code>fgets(name.a,50,stdin);</code></li>
  </ul></li>
  </ul>
  
  <p><strong>Note :</strong> we can't use <code>gets</code> method as well</p>
  
  <p>So, If any other method is there, please provide me.</p>