cjones@isis.cs.du.edu (Charles J. Jones) (04/05/91)
Hello, I've been playing with Borland C++ for past few days and have come across something that really has me puzzled. The following program: 1:> #include <string.h> 2:> #include <stdio.h> 3:> 4:> main(void) 5:> { 6:> char string[10]; 7:> char *str1 = "abcdefghi"; 8:> 9:> strcpy(string, str1); 10:> printf("%s\n", string); 11:> return 0; 12:> } (straight out of their help system) gives the following error: Error Line 9: Type of parameter 1 does not match strcpy(char*, const char *) This all worked fine under Turbo C++. I can cast the array with (char*) and then everything is great. Does this indicate something wierd with Borland C++? Or is there some stricter type checking that has come along in the language in the interim between Turbo and Borland C++'s. It seems a bit bizarre that the const char * of the array is incompatable with plain char *. Comments? Charles -- --------------------------------------------------------------------------- Charles J. Jones | If builders built buildings the way programmers cjones@nyx.cs.du.edu | write programs, then the first woodpecker that cjones@copper.denver.colorado.edu | came along would destroy civilization.