Jump to content
  • Advertisement
Sign in to follow this  
ender_341

error C2440: '=' : cannot convert from 'const char [2]' to 'char'

This topic is 4931 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I get this error: h:\CompSci1\calculater\Calculator.cpp(45): error C2440: '=' : cannot convert from 'const char [2]' to 'char' from this line of code: yesno = "Y"; it is declared as: char yesno;

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by RigidBody
Well as we are nitpicking grammar.


"We" weren't; the previous nitpick was about spelling.

Quote:
char yesno;

Is a definition, not a declaration. =P


Good attempt, but actually it is the other way around. To "declare" something is to say it exists; to "define" it is to say what it is. Thus this is the declaration; yesno = 'Y' would be a definition. Although, my understanding of the word "grammar" has nothing to do with the meanings of words...

Share this post


Link to post
Share on other sites
Quote:
Original post by Zahlman
Quote:
Original post by RigidBody
Well as we are nitpicking grammar.


"We" weren't; the previous nitpick was about spelling.

Quote:
char yesno;

Is a definition, not a declaration. =P


Good attempt, but actually it is the other way around. To "declare" something is to say it exists; to "define" it is to say what it is. Thus this is the declaration; yesno = 'Y' would be a definition. Although, my understanding of the word "grammar" has nothing to do with the meanings of words...


You are incorrect.

extern char yesno;

is a declaration.

char yesno;

is a definition.

extern char yesno = 'a';

is a definition.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!