C program to print environment variables

Added By: Editorial Staff | Last Updated: | In: C Programming Tutorial


Today, we are going to share a C program to print environment variables. If you are a beginner and want to start learning the C programming, then keep your close attention in this tutorial as I am going to share a C program to print environment variables with the output.

We have designed this program for beginners for learning purpose. Copy below c program and execute it with c compiler to see the output of the program.

Output

SUDO_GID=0
MAIL=/var/mail/root
USER=root
SHLVL=1
HOME=/root
OLDPWD=/
SUDO_UID=0
LOGNAME=root
_=/usr/local/bin/forever
TERM=xterm-color
USERNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
LANG=en_US.UTF-8
SUDO_COMMAND=/bin/bash /opt/fwm/start.sh
SHELL=/bin/bash
SUDO_USER=root
PWD=/home

Share this post!


About: Editorial Staff

Editorial Staff at FreeWebMentor is a team of professional developers leads by Prem Tiwari