Where should variable should declare | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Where should variable should declare

7th Jul 2018, 7:09 AM
Sameer Kulkarni
Sameer Kulkarni - avatar
2 Answers
+ 10
you can declare variables in functions,scopes e.t.c https://www.sololearn.com/learn/CPlusPlus/1606/
7th Jul 2018, 7:23 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 1
In cpp, you can declare a variable anywhere you want, remember declare it prior to using anywhere in the code. also do keep in mind, a variable declared in a local scope has no existence outside the scope.
7th Jul 2018, 7:59 AM
Nikhil Dhama
Nikhil Dhama - avatar