a basic question about declaring variables

Hello everyone,
please have a lookk at this snipet of code:

https://computing.llnl.gov/tutorials/pthreads/samples/hello_arg3.c

it's a webpage in this tutorial https://computing.llnl.gov/tutorials/pthreads/

It basically states that passing a struct variable (declared in main(){}) as reference in the pthread_create() fn, is unsafe as the memory location of the variable (t in this case) may change.

Why is that so?
I thought global variable's location on the memory are -for all practical purposes- fixed throughout the execution.

Thank you for your help and clarification
nass
It basically states that passing a struct variable (declared in main(){}) as reference in the pthread_create() fn, is unsafe as the memory location of the variable (t in this case) may change.

The memory location does not change, nor does the comment say that.
The value of the variable changes, not its address. What's more, passing a local variable such as this could cause it to go out of scope while some thread is still trying to access it.
Topic archived. No new replies allowed.