// A demo of using command line arguments
// This program will start an argument with you
// It will take whatever you say and refuse to agree

// Marc Chee (cs1511@cse.unsw.edu.au)
// Edited March 2020

#include <stdio.h>

int main(int argc, char *argv[]) {
    printf("Well actually %s says there's no such thing as ", argv[0]);
    int i = 1;
    while (i < argc) { // have written i - 1 words from argv to stdout
        fputs(argv[i], stdout);
        printf(" ");
        i++;
    }
    printf("\n");
}

Resource created Thursday 15 October 2020, 10:40:26 PM.

file: arguments.c


Back to top

COMP1511 20T3 (Programming Fundamentals) is powered by WebCMS3
CRICOS Provider No. 00098G