can i write int a=1, b=2;. ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

can i write int a=1, b=2;. ??

2nd Oct 2016, 11:44 PM
giannis avramidis
giannis avramidis - avatar
22 Answers
+ 6
yes because in c++ it is not necessary to declare every variable to data type.
18th Oct 2016, 4:00 AM
Aman Singh Tomar
Aman Singh Tomar - avatar
+ 2
yes
16th Oct 2016, 10:12 AM
Abinaya
Abinaya - avatar
+ 2
yes
5th Feb 2017, 6:40 AM
aaa
+ 1
yes bro
6th Oct 2016, 4:00 PM
Umar Safdar
Umar Safdar - avatar
+ 1
yes
31st Jan 2017, 2:53 PM
raj anthwal
raj anthwal - avatar
0
yes
3rd Oct 2016, 12:42 AM
ChillzTheCoder
0
thank you :)
3rd Oct 2016, 12:53 AM
giannis avramidis
giannis avramidis - avatar
0
yes...of course!
6th Oct 2016, 2:47 AM
Surajit Das
Surajit Das - avatar
0
yap
6th Oct 2016, 9:00 PM
Liudas Stanžys
Liudas Stanžys - avatar
0
yes you can
13th Oct 2016, 7:24 PM
sahag
sahag - avatar
0
yeah
13th Oct 2016, 7:26 PM
Liudas Stanžys
Liudas Stanžys - avatar
0
Yes . if it works no problem :)
18th Oct 2016, 6:54 AM
Mustafa calis
Mustafa calis - avatar
0
yes it will work
1st Feb 2017, 5:24 PM
Vivek Kumar
Vivek Kumar - avatar
0
yes by adding (,) and declaring var is done
2nd Feb 2017, 12:40 PM
asheesh
asheesh - avatar
0
yes
2nd Feb 2017, 3:17 PM
Hritik Bhattacharya
0
Guys thanks to those with good intention but the rest stop answering to get achievements!! Be serious!!!!!
2nd Feb 2017, 3:20 PM
giannis avramidis
giannis avramidis - avatar
0
More than one variable can be assigned like this if it belongs to same data types.
4th Feb 2017, 6:38 AM
Rejith K Ravindran
Rejith K Ravindran - avatar
- 1
yes
31st Jan 2017, 4:10 PM
Alexander
- 1
yes you can
1st Feb 2017, 9:18 PM
Tails Ex Machina
Tails Ex Machina - avatar
- 1
yes
2nd Feb 2017, 7:03 AM
Mangesh Sonawane
Mangesh Sonawane - avatar