variable declaration and assignment of value | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

variable declaration and assignment of value

if it is possible to declare several variables of the same data type in one declaration, is it also possible to assign values to several variables in just one declaration?

23rd Jul 2018, 10:23 AM
EMMANUEL
2 Answers
+ 2
The best way to learn to Code is to Code so you should first try it by yourself in Code PlayGround and then seek help What TurtleShell posted is correct and you can even assign values dynamically Refer to the Sololearn course for more info By your question it seems that you are a begginer so keep coding and again try things yourself first if that doesn't help we are always here to help Regards...........
23rd Jul 2018, 10:44 AM
Devansh Gupta
Devansh Gupta - avatar
+ 1
Use commas int a, b, c; If you want to assign values to some of them do it like normal int a, b = 16, c = 23;
23rd Jul 2018, 10:37 AM
TurtleShell
TurtleShell - avatar