By the way, this is perfectly legal in any C variation:
char something[50] = { ''S'', ''t'', ''r'', ''i'', ''n'', ''g'', ''s'' };
strings...damn them
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
July 11, 2000 12:27 AM
vbisme, the reason your code doesn''t work is because myString isn''t a char, it''s a char*. Therefore if you change your GetmyString() to this:
it will work.
char* Test::GetmyString(){ return (myString);}
it will work.
Ha!
I just consulted a book on valid C syntax.
This is legal. If it doesn''t work, then your compiler sucks because it doesn''t recognize valid syntax.
char something[50] = "Strings";
I just consulted a book on valid C syntax.
This is legal. If it doesn''t work, then your compiler sucks because it doesn''t recognize valid syntax.
char something[50] = "Strings";
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
if...:
class Test
{
private:
char myString;
char *Test::GetmyString()
{
return (mySring);
}
Compiler Error: cannot convert from ''char[50]'' to ''char[]''
class Test
{
private:
char myString;
char *Test::GetmyString()
{
return (mySring);
}
Compiler Error: cannot convert from ''char[50]'' to ''char[]''
July 11, 2000 01:39 AM
vbisme,
What compiler are you using? What are the settings?
Try this:
Although I''m not quite sure why it''s giving that error.
What compiler are you using? What are the settings?
Try this:
class Test{private: char myString; char* Test::GetmyString() { return (char*)(mySring); }};
Although I''m not quite sure why it''s giving that error.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement