C Programming Variable Initialization

Hey my name is Junaid Shahid. Hope you were fine. Today I will explain you about the c programming variable initialization. After variable declaration and variable definition now its variable initialization the next phase of c programming variables.


Initialization of variable means to define the value of variable. In the last article I have explained variable definition. In that I have explained, to define the limitation but in this phase we have to define the values of the variables. You can initialize the variable on the time of declaration or after declaration. Both conditions are the acceptable in professional programming.

In the code above you can see two different ways of initialization. Both are error free and used in programming commonly as the desire of programmer. Sometime we have initialized the value of variables before code further. It’s depending on the situations. As an example user don’t have enter the values you will given the values during programming and when code will executed only output shows. In this scenario you can use the initialization method of variable. To initialized the value first and then simple show output with one line code of print function.

There are many examples of the non user define inputs. Some time you have to just code quickly in that case you don’t go to write scanf function to take input. Just initialized the variables with random values and solved the problem.


I hope c programming variable initialization is cleared you. You can practice the code above to understand the logic. I have completed all the four phases of c programming variables. From now we will move on operators to understand the relations. Join my Facebook Group and discuss your programming problems with me. I will like to solve your problems.


CommentLuv badge