avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Help please: unsigned long + = unsigned char * unsign


From: dimax un
Subject: Re: [avr-gcc-list] Help please: unsigned long + = unsigned char * unsigned char
Date: Tue, 22 Aug 2006 16:44:45 +0200

On 8/22/06, address@hidden <address@hidden> wrote:


Dear,

Help, please! The value of c is not what we expect. It should be 50001, but 
4294951761!

Condition: mcu=atmega16 WinAVR20060421



#include

int main(void){

volatile unsigned char a,b;

volatile unsigned long c;

a=250;

b=200;

c=1;

c+=a*b;

Try  c+=(unsigned long)a*(unsigned long)b


return 0;

}



B.R.

Niu Yong ________________________________

超大U盘免费等你拿


*用搜狗拼音写邮件,体验更流畅的中文输入>>
































_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list




reply via email to

[Prev in Thread] Current Thread [Next in Thread]