title: while writing data in .dat file with the help of fwrite() function using in loop, why at random positions the null blocks are created in memory?
body: <p><strong>Code of 121_5.c</strong> ( 121_5.c is a program name)</p>
  <pre><code>#include&lt;stdio.h&gt;
  
  typedef struct student
  {
      char name[40];
      int age;
  }STUDENT;   // size is 44 bytes
  
  int main()
  {
      int i;
      char ch;
      STUDENT s[12]={
                       {&quot;ruturaj&quot;,0},{&quot;kailsh&quot;,1},{&quot;vedant&quot;,2},{&quot;sakshi&quot;,3},
                       {&quot;aaditya&quot;,10},{&quot;tejas&quot;,11},{&quot;santosh&quot;,12},{&quot;pankaj&quot;,13},
                       {&quot;samruddhi&quot;,20},{&quot;kristen&quot;,21},{&quot;emma&quot;,22},{&quot;brad&quot;,23}
                                                          
                   },s1;
                   
      FILE *fp;
      fp=fopen(&quot;121_para_5.dat&quot;,&quot;w&quot;);   // 121_para_5 is file name
      printf(&quot;fp-&gt; %d\n&quot;,ftell(fp));
  
      for(i=0;i&lt;=11;i++)
      {
          fwrite(&amp;s[i],sizeof(STUDENT),1,fp);
          printf(&quot;i=%-2d  fp-&gt; %d\n&quot;,i,ftell(fp)); // -2d is just for alligen
      }
      fclose(fp);
  
      fp=fopen(&quot;121_para_5.dat&quot;,&quot;r&quot;);
  
      fseek(fp,220,SEEK_SET);  // at this position null block created in memory
      printf(&quot;fseek -&gt; %d\n&quot;,ftell(fp)); 
  
      ch=fgetc(fp);  // retriving character at 220th position
      printf(&quot;%d&quot;,ch);
  
      fclose(fp);
  }
  </code></pre>
  <p><strong>Output</strong></p>
  <p><a href="https://i.stack.imgur.com/108mJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/108mJ.jpg" alt="Output" /></a></p>
  <p><strong>output in text format</strong></p>
  <pre><code>fp-&gt; 0
  i=0   fp-&gt; 44
  i=1   fp-&gt; 88
  i=2   fp-&gt; 132
  i=3   fp-&gt; 176
  i=4   fp-&gt; 221
  i=5   fp-&gt; 265
  i=6   fp-&gt; 309
  i=7   fp-&gt; 353
  i=8   fp-&gt; 397
  i=9   fp-&gt; 441
  i=10  fp-&gt; 485
  i=11  fp-&gt; 529
  fseek -&gt; 220
  0
  --------------------------------
  Process exited after 0.6639 seconds with return value 0
  Press any key to continue . . .
  </code></pre>
  <p>Now see while writing data in .dat file, I am checking a position where the file pointer is pointing.
  so file pointer initially pointing to position 0 and position increase by 44 each time, as the size of student data type is 44</p>
  <p>but after data enter from 176-219(44 bytes) the 220th position is filled with null, then data writing start normally from 221th position.
  so my question is why suddenly  null character goes at 220th position.</p>
  <p>now I increase input data and run loop for more times to check where can I get null again
  so I got it at 1101,1454,1983,2336,1689,3042......</p>
  <p><strong>output when further increase in data</strong></p>
  <p><a href="https://i.stack.imgur.com/apEP7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/apEP7.jpg" alt="output when further increase in input " /></a></p>
  <p><strong>output in text mode</strong></p>
  <pre><code>fp-&gt; 0
  i=0   fp-&gt; 44
  i=1   fp-&gt; 88
  i=2   fp-&gt; 132
  i=3   fp-&gt; 176
  i=4   fp-&gt; 221
  i=5   fp-&gt; 265
  i=6   fp-&gt; 309
  i=7   fp-&gt; 353
  i=8   fp-&gt; 397
  i=9   fp-&gt; 441
  i=10  fp-&gt; 485
  i=11  fp-&gt; 529
  i=12  fp-&gt; 573
  i=13  fp-&gt; 617
  i=14  fp-&gt; 661
  i=15  fp-&gt; 705
  i=16  fp-&gt; 749
  i=17  fp-&gt; 793
  i=18  fp-&gt; 837
  i=19  fp-&gt; 881
  i=20  fp-&gt; 925
  i=21  fp-&gt; 969
  i=22  fp-&gt; 1013
  i=23  fp-&gt; 1057
  i=24  fp-&gt; 1102
  i=25  fp-&gt; 1146
  i=26  fp-&gt; 1190
  i=27  fp-&gt; 1234
  i=28  fp-&gt; 1278
  i=29  fp-&gt; 1322
  i=30  fp-&gt; 1366
  i=31  fp-&gt; 1410
  i=32  fp-&gt; 1455
  i=33  fp-&gt; 1499
  i=34  fp-&gt; 1543
  i=35  fp-&gt; 1587
  i=36  fp-&gt; 1631
  i=37  fp-&gt; 1675
  i=38  fp-&gt; 1719
  i=39  fp-&gt; 1763
  i=40  fp-&gt; 1807
  i=41  fp-&gt; 1851
  i=42  fp-&gt; 1895 
  </code></pre>