#include <stdio.h>
#include <omp.h>
int main() {
int var = 13;
#pragma omp parallel firstprivate(var)
{
printf("Inside parallel region: var = %d\n", var); // var = 13 for each thread
var = var + 5; // Each thread's private var is modified, but the main var remains unchanged
}
printf("After exiting parallel region: var = %d\n", var); // var = 13 (no changes outside)
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxvbXAuaD4KCmludCBtYWluKCkgewogICAgaW50IHZhciA9IDEzOwogICAgI3ByYWdtYSBvbXAgcGFyYWxsZWwgZmlyc3Rwcml2YXRlKHZhcikKICAgIHsKICAgICAgICBwcmludGYoIkluc2lkZSBwYXJhbGxlbCByZWdpb246IHZhciA9ICVkXG4iLCB2YXIpOyAvLyB2YXIgPSAxMyBmb3IgZWFjaCB0aHJlYWQKICAgICAgICB2YXIgPSB2YXIgKyA1OyAvLyBFYWNoIHRocmVhZCdzIHByaXZhdGUgdmFyIGlzIG1vZGlmaWVkLCBidXQgdGhlIG1haW4gdmFyIHJlbWFpbnMgdW5jaGFuZ2VkCiAgICB9CiAgICBwcmludGYoIkFmdGVyIGV4aXRpbmcgcGFyYWxsZWwgcmVnaW9uOiB2YXIgPSAlZFxuIiwgdmFyKTsgLy8gdmFyID0gMTMgKG5vIGNoYW5nZXMgb3V0c2lkZSkKICAgIHJldHVybiAwOwp9