title: How to print a text in the middle of the screen in C programming?
body: <p>I did manage to get to the horizontal line (row) to the center but not vertically.
  Please help, I am still a noob so if you can explain your code, that would be much appreciated. </p>
  
  <p>Thanks </p>
  
  <pre><code>#include &lt;sys/ioctl.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main()
  {
  
      struct winsize w; 
      ioctl(0, TIOCGWINSZ, &amp;w); 
  
      int columns = w.ws_col; 
      int rows = w.ws_row;
  
  
      //printf("Lines :  %d\n", rows);
      //printf("Columns ; %d\n", columns);
  
      char *string = "Hello World";
      int stringLength = strlen(string) / 2;
  
  
  
      printf("%*s\n", columns / 2 + stringLength, string );
      //getchar();                //Pause program
  
      return 0;
  }
  </code></pre>