Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Variable scope

$
0
0

I little confused about variable defenition in the following code:

#include <msp430.h>

int b = 3;

int main(void) {
  WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer

  b=2;

  for(;;){;}

  return 0;
}

When I debug the program and watch the variable 'b', why does it not initialize to value of 3?  It does change to value of 2 as I step through the program, but why would it not initialize to value of 3?

My uC is MSP430FR5739, IDE is CCS 5.3


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>