could you tell me why strcpy produces a runtime error here? Should the destination string be empty? And if so, why?
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[]) {
char* input = "Nascartestdriver"; // strlen(input) == 16
char* output = "asdfdhsghsdfasdf"; // strlen(output) == 16
strcpy(output, input);
printf("%s\n", output);
return 0;
}
Thanks.
Because
strcpy()
tries to write on read-only section.