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

Resource created Friday 22 May 2020, 10:26:41 AM, last modified Wednesday 15 July 2020, 02:23:40 PM.

file: arguments.c


Back to top

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