Local Variables
Learn how local variables work in functions.
We'll cover the following...
We'll cover the following...
Local variables example
Local variables are variables that are only available and accessible within the function.
Source code
The source code of the local variables is given below:
int main(){int a, b;a = 1;b = 1;b = b + a;++a;b = b * a;return 0;}
Compilation and execution of code
We compile the file and load the executable into the GDB:
gcc LocalVariables.cpp -o LocalVariablesgdb ./LocalVariables
The output after loading the executable file will be as follows:
Then we put a breakpoint to the main
function:
break main
The breakpoint of the ...