Hi folks.
I'm trying to do something I hope is very simple -- taking an argument placed after the program's name and storing it. So, if I type whatnumber 4 it will store the value 4, whatnumber 100 will store 100, etc. I've tried using int argc, char *argv[] instead of the usual void, but I don't understand exactly how this is passed -- for some reason this hasn't (yet) been covered in class and it's the first part of an assignment I'm trying to do.
Thanks guys.
much love,
sd
#include <stdio.h>
int main ( int argc, char *argv[] ) {
int number = 4;
printf("Number is %d", argv[1]);
return 0;
}