OpenMP Directives: Data Scope Attribute Clauses: SHARED Clause
Purpose:
The SHARED clause declares variables in its list to be shared among all threads in the team.
Format:
Fortran
SHARED (list)
C/C++
shared (list)
Notes:
A shared variable exists in only one memory location and all threads can read or write to that address.
It is the programmer’s responsibility to ensure that multiple threads properly access SHARED variables (such as via CRITICAL sections).




