2011-09-09 13:17:53 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int i = 0;
|
2011-09-09 18:36:58 +00:00
|
|
|
|
2012-02-14 03:11:10 +00:00
|
|
|
// go through each string in argv
|
|
|
|
// why am I skipping argv[0]?
|
2011-09-09 18:36:58 +00:00
|
|
|
for(i = 0; i < argc; i++) {
|
|
|
|
printf("arg %d: %s\n", i, argv[i]);
|
|
|
|
}
|
|
|
|
|
2012-02-14 03:11:10 +00:00
|
|
|
// let's make our own array of strings
|
2011-09-09 18:37:10 +00:00
|
|
|
char *states[] = {
|
|
|
|
"California", "Oregon",
|
|
|
|
"Washington", "Texas"
|
|
|
|
};
|
|
|
|
int num_states = 4;
|
2011-09-09 18:36:58 +00:00
|
|
|
|
2011-09-09 18:34:40 +00:00
|
|
|
for(i = 0; i < num_states; i++) {
|
|
|
|
printf("state %d: %s\n", i, states[i]);
|
2011-09-09 13:17:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|