Is it possible to initialize a variable at the time it was declared?
4 years ago
C Programming
Yes, you don't have to write a separate assignment statement after the variable declaration, unless you plan to change it later on. For example: char planet[15] = "Earth"; does two things: it declares a string variable named planet, then initializes it with the value "Earth".
Sanisha Maharjan
Jan 20, 2022