Illogical Type Changing


hey..im new arduino..i m experienced in c programming..i m gonna give little example..

quote

long int myresult;

void setup()
{
serial.begin(9600);
}

void loop()
{
  myresult=1400*1000;
  serial.println(myresult);
  while(1);
  
}



in example..programe gave me illogical answer.. if changed types of 1400 , 1000 "long int" , right answer..but why have change type of these integer? these not long integer..of course result of 2 short integers's multiplication might long integer, here..so changed type of result..do u think logical? whats reason of usage? u think?

nothing @ illogical 16 bit arithmetic.


Arduino Forum > Using Arduino > Programming Questions > Illogical Type Changing


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support