breaking ex10
This commit is contained in:
parent
da1b3f8508
commit
5a86af46b0
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ ex6
|
||||
ex7
|
||||
ex8
|
||||
ex9
|
||||
ex10
|
||||
|
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
||||
CFLAGS=-Wall -g
|
||||
|
||||
EXERCISES = ex1 ex3 ex4 ex5 ex6 ex7 ex8 ex9
|
||||
EXERCISES = ex1 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10
|
||||
|
||||
|
||||
all: $(EXERCISES)
|
||||
|
10
break-ex10.py
Normal file
10
break-ex10.py
Normal file
@ -0,0 +1,10 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
argc = int(sys.argv[1]) if sys.argv[1:] else 23694
|
||||
command = "valgrind ./ex10 " + " ".join(map(str, range(argc)))
|
||||
print("command = {}".format(command))
|
||||
|
||||
os.system(command)
|
22
ex10.c
Normal file
22
ex10.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for(i = 0; i < argc; i++) {
|
||||
printf("arg %d: %s\n", i, argv[i]);
|
||||
}
|
||||
|
||||
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