You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
495 B
26 lines
495 B
13 years ago
|
#include <stdio.h>
|
||
|
|
||
|
int main(int argc, char *argv[])
|
||
|
{
|
||
|
int i = 0;
|
||
13 years ago
|
|
||
13 years ago
|
// go through each string in argv
|
||
|
// why am I skipping argv[0]?
|
||
13 years ago
|
for(i = 0; i < argc; i++) {
|
||
|
printf("arg %d: %s\n", i, argv[i]);
|
||
|
}
|
||
|
|
||
13 years ago
|
// let's make our own array of strings
|
||
13 years ago
|
char *states[] = {
|
||
|
"California", "Oregon",
|
||
|
"Washington", "Texas"
|
||
|
};
|
||
|
int num_states = 4;
|
||
13 years ago
|
|
||
13 years ago
|
for(i = 0; i < num_states; i++) {
|
||
|
printf("state %d: %s\n", i, states[i]);
|
||
13 years ago
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|