Link to home
Start Free TrialLog in
Avatar of LuckyLucks
LuckyLucks

asked on

multiple initialization in one line

Hi
I want to initialize a few variable to a particular value. I want to do this in one line for cleaner code.
For example:

int a,b,c=5;

I am using Visual studio. Only the last variable c seems to be initialized to 5.

Multiple initialization is not possible, or is it? And if so, how?
SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not sure about VS but in true batch you can enter multiple commands on one line by separating each with the "&" character.  

Try this from a command line:

set a=5 &set b=5 &set c=5 &echo a = %a% &echo b = %b% &echo c = %c%
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks, but you should turn the accepted solution and the assist (with points). HookooDooKu posted the solution. my comment was an add-on.

Sara