On 8/20/06, Prince Bhanwra <[EMAIL PROTECTED]> wrote:
hey
full form of "getch" is get a character. So it returns only one value and that a char value. By standards it cannot return int.

getch() isn't in either C or C++ Standard, so that's wrong.

In addition, most implementations that /do/ provide a getch() function, have it returning an int so you can tell if it's returning an error. Otherwise you cannot tell the difference between (say) 255 and -1 being returned.
 

value but some compilers don't give any error or warning and sometime it also works fine.

Any compiler worth it's salt should at least give a truncation warning (granted they aren't required to however)
 

But you should try not to go for it. You may opt for typecasting afterwards, if required results needs to be in int.
 
SYNTAX:
 
char test;
test = getch();
cout<<"test";

This code will not output what you appear to think/indicate it will output.
 



--
PJH

Into motorcycles? Need parts? Try www.gissit.com to contact lots of motorcycle breakers - free to use (UK based at the moment) __._,_.___

To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.




SPONSORED LINKS
C and c++ Computer programming languages Java programming language
Basic programming language Programming languages


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to