Jump to content

c++ array with char?


Go to solution Solved by JachuPL,

Recommended Posts

  • 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

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

  • 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

  • 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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

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.