need help with an assignment

This is a discussion on need help with an assignment within the C Programming forums, part of the General Programming Boards category; i need help in writing........... a C program (not a C++ program!) that utilizes all three arguments available to the ...

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    2

    need help with an assignment

    i need help in writing...........
    a C program (not a C++ program!) that utilizes
    all three arguments available to the main function:

    int main( int argc, char *argv[], char *env[] )

    Where:

    argc = the number of arguments passed to the program

    argv = a pointer to an array of the actual contents of
    the arguments

    env = a pointer to an array of environment variables
    passed to the program by the Operating System.





    1. Loop through the argument array (argv) and
    print each of the command line arguments to the
    standard output.

    2. Test each command line argument to see if the
    first character is an integer (using isdigit(...) ).
    If the first characer is a digit, then print a line
    “argv[i] is an integer”. Otherwise print a line
    “argv[i] is a character array”

    3. Print out a number that is the summation of
    all arguments whose values are integer.

    4. Loop through the environment variable array
    (env). Print the following to the standard output,
    labeling appropriately:

    a. the first environment string.

    b. the value associated with the "HOSTNAME"
    variable. The strtok(...) or strtok_r(...) function
    may be helpful.

    c. The value associated with the "USER"
    variable.

    d. The last environment string.

    5. Print a count of how many environment
    variables there were.



    thnx in advance

  2. #2
    Registered User
    Join Date
    Jun 2005
    Location
    Stockholm, Sweden
    Posts
    64
    How much have you written already?
    What parts are you unsure of?

  3. #3
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    And your question is?

    You ought to read the forum guidlines and the rules regarding homework before you post again.

    thnx in advance

    ~/
    Last edited by kermit; 06-25-2005 at 03:07 AM.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    2
    got it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Menu
    By Krush in forum C Programming
    Replies: 17
    Last Post: 09-01-2009, 03:34 AM
  2. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 07:22 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. Help with a pretty big C++ assignment
    By wakestudent988 in forum C++ Programming
    Replies: 1
    Last Post: 10-30-2006, 09:46 PM
  5. Replies: 1
    Last Post: 10-27-2006, 02:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21