In the paradigm of procedural programming (and in OOP as well), such thing is not only impossible, but also wrong. If you need to access the local variables of a block of code outside of it, it means that you structured the whole block in the wrong way; there are in fact two possibilities:
- The operation you want to accomplish on the local variables is logically part of the block containing such variables. In this case, simply extend it.
- You need the value of the local variables outside the block containing them, to perform different operations every time (I understand this is your case). In this situation, the variables are then logically part of the result of the execution of the block containing them. A clean, correct way to handle this is to encapsulate said block of code, and to return a structured data type that contains every value you need to access outside of it.