Jump to content
×
×
  • Create New...
  • 0

c++ array with char?


.Avenue™

Question

  • Premium
char titles[] = {
			{"Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text"},
			{"Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text"},
			{"Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text", "Text"},
		};
1>.InstanceBaseEffect.cpp(683) : error C2440: 'initializing' : cannot convert from 'const char [15]' to 'char'
1>        There is no context in which this conversion is possible
1>.InstanceBaseEffect.cpp(683) : error C2078: too many initializers
1>.InstanceBaseEffect.cpp(684) : error C2440: 'initializing' : cannot convert from 'const char [8]' to 'char'
1>        There is no context in which this conversion is possible
1>.InstanceBaseEffect.cpp(685) : error C2440: 'initializing' : cannot convert from 'const char [7]' to 'char'
1>        There is no context in which this conversion is possible
1>.InstanceBaseEffect.cpp(689) : error C2109: subscript requires array or pointer type

why?

Link to comment
Share on other sites

  • Answers 6
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

6 answers to this question

Recommended Posts

  • 0
  • Premium
1>.InstanceBaseEffect.cpp(683) : error C2552: 'titles' : non-aggregates cannot be initialized with initializer list
1>        'std::basic_string<_Elem,_Traits,_Ax>' : Types with a base are not aggregate
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>,
1>            _Ax=std::allocator<char>
1>        ]
1>.InstanceBaseEffect.cpp(684) : error C2552: 'titles' : non-aggregates cannot be initialized with initializer list
1>        'std::basic_string<_Elem,_Traits,_Ax>' : Types with a base are not aggregate
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>,
1>            _Ax=std::allocator<char>

1>        ]
1>.InstanceBaseEffect.cpp(685) : error C2552: 'titles' : non-aggregates cannot be initialized with initializer list
1>        'std::basic_string<_Elem,_Traits,_Ax>' : Types with a base are not aggregate
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>,
1>            _Ax=std::allocator<char>
1>        ]

if I do string titles [] = ...

Link to comment
Share on other sites

  • 0
  • Premium
		char* nocolony[] = {"Colony Trainee", "Colony Graduate",  "Vagabond", "Disciple", "Billionaire", "10 Billionaire", "50 Billionaire"};
		char* procyon[] = {"Praetor", "Praetor of Silence", "Praetor of Insight", "Preator of Tolerance", "Praetor of Glory", "Praetor of Faith", "Praetor of Will", "Praetor of Truth", "Praetor of Brilliance", "The Quaestor", "Luminosity Bringer", "Luminosity Guardian", "Luminous Gladiator", "Luminous Great Gladiator", "Luminous Supreme Gladiator", "Luminous Officer", "Luminous Great Officer", "Luminous Supreme Officer", "Luminous Captain", "Luminous General", "Luminous Commander", "Luminous Hero", "Luminous Legend", "Luminous God"};
		char* capella[] = {"Knight", "Knight of Dawn", "Knight of Fighting", "Knight of Passion", "Knight of Protection", "Knight of Valor", "Knight of Devotion", "Knight of Judgement", "Knight of Tempest", "The Sovereign", "Storm Bringer", "Storm Guardian", "Stormy Gladiator", "Stormy Great Gladiator", "Stormy Supreme Gladiator", "Stormy Officer", "Stormy Great Officer", "Stormy Supreme Officer", "Stormy Captain", "Stormy General", "Stormy Commander", "Stormy Hero", "Stormy God"};
		char* *titles[] = {nocolony, capella, procyon};

works, i hope.. compilation successfull

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.