title: Print a structure in a String format in C
body: <p>I one of my assignment, I have a task to print the below whole structure in a string format.</p>
  
  <pre><code>Struct test
  {
      int a,
      char char1,char2;
  }
  </code></pre>
  
  <p>output should be: Structure is a=10,char1=b,char2=c;
  I know it is very simple by using</p>
  
  <pre><code>printf("Structure is a=%d,char1=%c, char2= %c", s.a,s.char1,s.char2);
  </code></pre>
  
  <p>But in real-time, I have a lot of big structures and I cannot write printf statements with access specifiers for each element of structure. Is there any other way to print the whole structure with just specifying the structure variable or some other? </p>