title: Setting background color of root window
body: <p>I am trying to learn XLib. And I searched throught source of Feh program to understand how to modify root window, but I had no results.</p>
  
  <p>There is code to test root window access, but I don't understand why it is not working.</p>
  
  <pre><code>#include &lt;X11/Xlib.h&gt;
  #include &lt;stdio.h&gt;
  
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  
  Display *disp2;
  Window root2;
  
  int main(int argc, char *argv[])
  
  {
  
   disp2 = XOpenDisplay(NULL); 
   root2 = RootWindow(disp2, DefaultScreen(disp2));
   // Generation of random number to set window color
   srand(time(NULL));
   int i = rand();
   // Setting background
   // I forgot to change 256 to i
   // XSetWindowBackground(disp2, root2, 256 );
   XSetWindowBackground(disp2, root2, i
   XClearWindow(disp2, root2);
   // Showing the random number
   printf ("%i \n", i );
  
   return 0;
  
  }
  </code></pre>
  
  <p>So, what's wrong in this code?</p>