Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

passing environment variables to c main function

Nice Narwhal answered on March 6, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • giving arguments to main function in c
  • get an environment variable in c
  • params in main function in C
  • how to get variable from another function in c
  • // CPP program to demonstrate pre increment
  • c how to include variables of other c file

  • passing environment variables to c main function

    0

    #include

    // https://man7.org/linux/man-pages/man7/environ.7.html

    extern char **environ;

    int main(int argc, char **argv) {

    // list out all the environment variables

    for (int i=0; environ[i]!=NULL; i++) {

    printf("%d: %s\n", i, envp[i]);

    }

    return 0;


    Popularity 3/10 Helpfulness 1/10 Language whatever
    Source: dev.to
    Link to this answer
    Share Copy Link
    Contributed on Mar 06 2023
    Nice Narwhal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.