Basically, here's what happens when you say:
inside your C program. Your computer will see that you need space for an integer. Let's say you need 8 bits (1 byte) to hold an integer. The computer finds a place in main memory that can hold your integer x. Let's say it picks a position 13 of a byte to store x in. Memory position 13 might have had some random bits already stored there, such as:
0110 1101
When the computer allocates memory, it leaves the data there unchanged. It merely says, "This position (in this case, position 13) is now the value of x!" And it is so. I'll repeat; during allocation, the pre-existing data still remains.
When you print x before initializing it yourself, you get the previous value, which wouldn't make sense in the context of your program. It might be 109, as above, it might be 1073828704, it might be 9382174, it might be -3284721341, who knows?
It is this reason that you should always initialize your variables, either to some convenient constant (0 or 1), or immediately use input to assign a variable. Any way you can, get some value into your variable before you use it.
The simplest way to do this is by replacing the above code with:
With this statement, the computer first allocates memory for 6 ("I declare position 42 to hold the value of x!"),
and then assigns 0 to that memory location. Now, no matter what was previously held in position 42, the bits are now:
0000 0000