auto
variables are not automatically initialized, they contain garbage. Those variables are allocated typically in the stack, with a quick stack operation. In foo(), you have such a variable, so the printf outputs random data.
Even if the function foo() was called recursively, the auto-variables problem stays there, every call makes a new stack frame
containing garbage.
So,
Is the stack frame of a function called multiple times different each time?
YES. Unless you use static
variables in that function. But then, you will have variables which keep their value, but which are in reality always the same (no more "local", or better, global but only visible in that function (scope)).
======== EDIT after comment ========
Well, the above sentence contains a formal error. It is not true that the stack frame will be different: it can be the same between calls (probably not if recursion is used). But, you can not be sure it is the same, so you must assume it is different each time. By assuming it is different, you state it is different, even if it is not true. Unless you want to exploit some arcane algorithm...