ex10
This commit is contained in:
parent
62724ef6bb
commit
120a767002
1
lcthw-remnants-2/.gitignore
vendored
1
lcthw-remnants-2/.gitignore
vendored
@ -7,3 +7,4 @@ ex7
|
||||
ex8
|
||||
ex9
|
||||
ex9-ec
|
||||
ex10
|
||||
|
25
lcthw-remnants-2/ex10.c
Normal file
25
lcthw-remnants-2/ex10.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
// go through each string in argv
|
||||
// why am I skipping argv[0];
|
||||
for(i = 1; i < argc; i++) {
|
||||
printf("arg %d: %s\n", i, argv[i]);
|
||||
}
|
||||
|
||||
// let's make our own array of strings
|
||||
char *states[] = {
|
||||
"California", "Oregon",
|
||||
"Washington", "Texas"
|
||||
};
|
||||
int num_states = 4;
|
||||
|
||||
for(i = 0; i < num_states; i++) {
|
||||
printf("state %d: %s\n", i, states[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user