diff --git a/ex11.c b/ex11.c index 7ff7988..eb4155d 100644 --- a/ex11.c +++ b/ex11.c @@ -1,4 +1,5 @@ #include +#include int main(int argc, char *argv[]) { @@ -21,11 +22,20 @@ int main(int argc, char *argv[]) } i = 0; + size_t l; + while(i < num_states) { - states[i] = argv[i]; + l = strlen((char *)&(argv[i])); + strncpy((char *)&(states[i]), (char *)&(argv[i]), l); printf("copied %s into state %d\n", states[i], i); i++; } + i = 0; + while(i < num_states) { + printf("state %d: %s\n", i, states[i]); + i++; + } + return 0; }