while I am trying to understand processes I noticed something
int main(){
pid_t pid,w;
printf("value of w: %d\n", w);
return 0;
}
When I run the above code, the value of w is 0. So far no problem.
BUT
when i added char array in the code like below
int main(){
pid_t pid,w;
char arr [3];
printf("value of w: %d\n", w);
return 0;
}
The value of w is randomly changing every time I run it. I can't understand the reason for this, What is the effect of the char array?