using strcpy instead of just copying pointers
This commit is contained in:
parent
1a1c89af7a
commit
c5e4c2cf26
5
ex11.c
5
ex11.c
@ -1,4 +1,5 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -22,8 +23,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
i = 0;
|
||||
while(i < num_states) {
|
||||
states[i] = argv[i];
|
||||
printf("copied %s into state %d\n", states[i], i);
|
||||
strcpy((char *)(&states[i]), argv[i]);
|
||||
printf("copied %s into state %d\n", argv[i], i);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user