| ??? 07/13/08 20:58 Modified: 07/13/08 21:02 Read: times |
#156669 - Confused by strcopy - C newb. |
#include <string.h>
#include <REG935.H>
void main()
{
char* data temp;
char* data temp2;
temp = "Test1";
temp2 = "Test2";
P2 = temp[4];
strcpy(temp, temp2);
P2 = temp[4];
while(1);
}
I expected this to result in P2 being set to 31 the first time, and then 32 the second time, but it was set to 31 both times. Am I missing something obvious? >> edit: Keil C, tested in simulator. |
| Topic | Author | Date |
| Confused by strcopy - C newb. | 01/01/70 00:00 | |
| ... the disassembly | 01/01/70 00:00 | |
| strcpy to a location in code memory | 01/01/70 00:00 | |
| String literals in program memory. | 01/01/70 00:00 | |
| Thank you both... | 01/01/70 00:00 | |
'temp' holds an address, not the char array. | 01/01/70 00:00 |



