Initialization of a Variable in C

After a variable is declared it may be required to initialize it. Initialization of a variable means assigning some value to it. However, technically there is no problem with using a variable without initializing it. But logically it is wrong. When a variable is declared but not initialized it contains some random bogus but valid value. As an example, if a variable x is declared as int, then x may contain say 1278 value before its initialization. The value is bogus but valid. There are generally 2 ways to initialize a variable.

1. First, during declaration we can assign some value to it. As an example,
int x = 1234;

This way variable x is initialized with value 1234 when it is declared as integer.

2. Second, after the variable is declared we can assign it some value in a separate statement. As an example,

int x;
x = 1234;