Modify environment variables of a running process

Use GDB to attach to the process

Set environment variable

Exit

Sample C Program

Build the code:

Run the code:

Initial Output:

Run gdb to attach to the process

Set env value and exit

Output after setting env variable: