lee@ssc-vax.UUCP (Lee Carver) (08/19/88)
In article <8180@cup.portal.com>, Jinfu@cup.portal.com writes: | I don't understand why following codes don't work: | #include <stdio.h> | #include <strings.h> | | main(argc, argv) | int argc; | char *argv; | { | char *str1; | strcpy(str1, argv[1]); | } | | The runtime error is 'access violation'. Of course it doesn't work!! In this program, str1 is a pointer to a sequence of characters. But where is the space for the sequence of characters? I guess I'm hot about this because you used my Subject: to bring up a unrelated issues. This is a simple C usage issue. Learn the language (or computer science in general).