NO

Author Topic: Quick watch does not work while debugging.  (Read 2797 times)

puredesi5

  • Guest
Quick watch does not work while debugging.
« on: April 28, 2013, 09:57:01 PM »
I have following program that works fine but when I debug and enter variables first and second (value provided by user) on the quick watch window, it works fine and shows proper values of the two variables. But, when I enter other variables (sum, diff, etc.), it says "Error in Expression" and does not show value even when I check towards the end of the program.  Any idea on why 'quick watch' or watch would work for two variables gotten with scanf but does not work on any other variable. I am sure it's propbably either due to some project option or Win 7 (64 bit/32 bit). Any help would be appreciated.
Code: [Select]
#include <stdio.h>

int
main(void)
{
      int    first, second, sum, diff, product ;
double quotient;

      printf("Enter two integers> ");
      scanf("%d%d", &first, &second); /* ERROR!! should be  &first, &second */
      sum = first + second;
      printf("%d + %d = %d\n", first, second, sum);

    diff = first - second;
      printf("%d - %d = %d\n", first, second, diff);

      product = first * second;
      printf("%d * %d = %d\n", first, second, product);

      quotient = first / second;
      printf("%d / %d = %d\n", first, second, quotient);

      return (0);
}
« Last Edit: April 29, 2013, 08:23:02 AM by Stefan Pendl »