I was given this set of code in my Intro to C class, I have never programmed in C so I am still learning. I though the answer was 7, can someone please explain why the answer is 5 and what can be changed to allow foo to update a without using global variables?
Code:int foo(int a){ a = 7; } int main(){ int a = 5; foo(a); printf("value is %d\n", a); }