Printing the bits of an integer using bitfields and union
Avoid global variables - there's no need for t and v to exist outside main().

Always check the return value of scanf() before using the written values.

Don't assume that CHAR_BIT is 8, or that sizeof (short) is 2.  Neither of those is portable.

Don't assume a particular ordering of bit fields within a struct - that's entirely compiler-dependent.

Portable code needs a loop to print the bits, like this:

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int main(void)
{
    short x;
    if (scanf("%hi", &amp;x) != 1) {
        fputs("Input error\n", stderr);
        return EXIT_FAILURE;
    }

    unsigned short v = (unsigned short)x;

    unsigned short mask = -1u;                /* 11111... */
    mask -= (unsigned short)(mask / 2);       /* 10000... */

    while (mask) {
        printf("%d ", (v &amp; mask) != 0);
        mask &gt;&gt;= 1;
    }
    printf("\n");
}