Value of uninitialized variable

Hi,

Im doing some simple noob stuf where I have an event (mouseClicked) that does something only if the mouse has moved to different coordinates.

So, at the beginning of the sketch I declare mouseXLog and MouseYLog but dont initizalize them

int mouseXLog,
mouseYLog;

Then in my event I have:

void mouseClicked() {
  if ([...]mouseXLog < mouseX || mouseXLog > mouseX || mouseYLog < mouseY || mouseYLog > mouseY) 
  {
    nrOfClicks++;
    mouseXLog = mouseX;
    mouseYLog = mouseY;
  }

And this works. My questions is:

How can "mouseXLog < mouseX || mouseXLog > mouseX || mouseYLog < mouseY || mouseYLog > mouseY" evaluate to true when it is initialized for the first time after the event?

Cheers,

Answers

Sign In or Register to comment.