+ 2

am I declaring an array wrong?

I'm using msvs 2015 and I'm getting error from this code; string mainPlayer[] = {name, money, exp, health};

30th Jul 2016, 4:35 PM
King JokerHA
King JokerHA - avatar
3 Answers
+ 1
declar the elements in ""
30th Jul 2016, 5:12 PM
abhijit bhusare
abhijit bhusare - avatar
+ 1
u r declaring strings in an array so be sure always to specify with ""
30th Jul 2016, 6:38 PM
Suhail Pappu
Suhail Pappu - avatar
0
If you are using variables make sure they are all strings if not you shoud put every value between "". If this is program is going to be a game you shoud use classes and object because is more useful and you have a better control over your data.
31st Jul 2016, 11:16 PM
bogdan
bogdan - avatar