When a local variable is defined, it is not initialized by the system,
you must initialize it yourself. Global variables are initialized
automatically by the system when you define them as follows:
| Data Type | Initial Default Value |
| int | 0 |
| char | '\0' |
| float | 0 |
| double | 0 |
| pointer | NULL |
It is a good programming practice to initialize variables properly otherwise, your program may produce unexpected results because uninitialized variables will take some garbage value already available at its memory location.
Post a Comment