Convert hex to binary from command line arguments C
<p>This is a homework assignment where I have to convert hex to binary when a command is called in the terminal. My "teacher" isn't really "teaching" C so I'm dead lost. I have to include a procedure, void printBits(unsigned long i), that prints the bits in i. It will be invoked from the command line using the '-p' switch followed by a 32-bit unsigned long integer in hex form. EX: $ lab3 -p 0x5</p>

<p>Output: 0000 0000 0000 0000 0000 0000 0000 0101</p>

<p>Please don't just give me the code. I need to understand this.</p>

<pre><code>void printBits(unsigned long number) {
    // Declare Array to hold our binary number
    char binaryNumber[32];
    // For Loop Index
    int i;
    for (i = 31; i &gt;= 0; --i)
    {
    binaryNumber[i] = (number &amp; 1);
    number &gt;&gt;= 1;
    }
</code></pre>