x * 1000L - what does the L do


hi,

1st post.

i have been working through arduio code , have hope basic question.

in code below works 'duration' multiplied 1000l.

why l @ end?
what mean.

code: [select]
void playtone(int tone, int duration) {
 for (long = 0; < duration *1000l; += tone *2) {
   digitalwrite(speakerpin, high);
   delaymicroseconds(tone);
   digitalwrite(speakerpin, low);
   delaymicroseconds(tone);
 }
}


i'm tryingt o understand when multiply 1000 , when multiply 1000l.

i tried removing l code failed, important.

any info appreciated.

albert.

quote
why l @ end? mean.

the l declares value long. without l, value of duration * 1000 interpreted int, can hold maximum value of 32,767, limiting duration maximum of 32.

with l, duration * 1000l treated long, can hold larger value.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > x * 1000L - what does the L do


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums