Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] C Code weird behaviour help?

2007-01-27 by Dave Hylands

Hi,

> Code that doesn't work:
>
> main ()
> {
>  unsigned int val;
>  unsigned int otherval;
>
> val = 650;
>
> while (1)
>  {
>   while (otherval < val)

otherval is currently uninitialized and will take on some random value
from the stack.

> Code that DOES work:
>
> main ()
> {
>  unsigned int otherval;
>
> while (1)
>  {
>   while (otherval < 650)

otherval is still uninitialized. The fact that it works is pure luck

-- 
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.