Can I declare a variable in cin statement like "cin>> int a; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can I declare a variable in cin statement like "cin>> int a;

28th Jul 2018, 12:55 PM
Praful Dhale
3 Answers
+ 5
You can always play around with it on playground or editors. If its true Great! If wrong you would get to know about error and learn something new on your own. Hope this helps ☺️☺️.
28th Jul 2018, 12:58 PM
Meet Mehta
Meet Mehta - avatar
+ 1
No because "a" has no value. Even cin << int a = 1; would not work because cin cannot accept an assignment.
28th Jul 2018, 1:15 PM
josh mizzi
josh mizzi - avatar
28th Jul 2018, 1:03 PM
Meet Mehta
Meet Mehta - avatar