#include <stdlib.h>char *colon_delimited_path = getenv("PATH")
returns a :-delimited list of the directories in PATH. To translate to an array, you can use strtok to split the string.
:
strtok