+ 1

Can you declare a variable without initializing it ?

Is it possible to say int a;

12th Jul 2019, 9:54 PM
Awah
7 odpowiedzi
+ 5
It's just a simple example he can declare the variable then get an input from user and give that value to the variable he declared
12th Jul 2019, 10:23 PM
Juan David Padilla Diaz
Juan David Padilla Diaz - avatar
+ 3
If you mean declare the variable e.g int a; Then you initialize it a = 9; yes you can do it
12th Jul 2019, 10:14 PM
Juan David Padilla Diaz
Juan David Padilla Diaz - avatar
+ 2
Yes. E.g. in C/C++/Java: int a; is valid.
13th Jul 2019, 12:11 AM
Sonic
Sonic - avatar
+ 1
That is exactly what I was thinking. Declare a variable and then accept input
12th Jul 2019, 10:42 PM
Awah