This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123GE6PM: Different examples of Globally and Locally defined variables

Part Number: TM4C123GE6PM

Hello,

I'm comparing the definitions of variable in both of these examples:

Section 15.3 of this document:

"www.ti.com/.../spmu371d.pdf"

vs 

lab 14 of this document

"software-dl.ti.com/.../TM4C123G_LaunchPad_Workshop_Workbook.pdf"

In the first example:

tI2CMInstance sI2CInst;

tMPU6050 sMPU6050;

Are declared locally inside a function.

In the second example - very similar variables exist:

tI2CMInstance g_sI2CInst;

tISL29023 g_sISL29023Inst;

But these are declared globally outside of main.

Why the difference ?